【问题标题】:Prompt for password when mysql client reconnectsmysql客户端重新连接时提示输入密码
【发布时间】:2012-10-10 15:52:38
【问题描述】:

我正在通过以下方式调用mysql:

mysql -h localhost -u user -p db 

这将导致用户被提示输入密码。

但是我已将 interactive_timeout 设置为 60 秒。

60 秒后,客户端将超时,但由于重新连接选项未设置为 false,因此它将尝试重新连接。 重新连接时,mysql 客户端不提示输入密码。 我想让它在重新连接时提示输入密码。 谁能帮我解决这个问题。

这是示例输出

mysql -h localhost -u user -p db 
Enter password: 
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 26
Server version: 5.1.58 MySQL Community Server (GPL)

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show variables;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    30
Current database: db

我希望它在重新连接时提示输入密码

【问题讨论】:

    标签: mysql security


    【解决方案1】:

    您可以尝试查看aliasing mysql 指定--skip-reconnect(与interactive_timeout 一起使用)是否有效

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2013-12-31
      • 2015-02-21
      • 2021-09-27
      • 1970-01-01
      • 1970-01-01
      • 2016-02-04
      • 2019-07-01
      • 1970-01-01
      相关资源
      最近更新 更多