mysql - mysql客户端重连时提示输入密码

标签 mysql security

我通过以下方式调用 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

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

最佳答案

你可以试试看是否aliasing mysql 指定--skip-reconnect (与 interactive_timeout 结合使用)会起作用

关于mysql - mysql客户端重连时提示输入密码,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12984304/

相关文章:

java - 捕获并存储所有 mysql 数据库数据(表行)以使用它们进行比较和匹配

mysql - mysql中 'join'需要什么

android - 接受自签名证书安全吗?

javascript - Node js - 如何安全地将 token 从 http get 请求传递到 html 页面?

php - 某个页面一次只有两个人?

php - Safari 和 iPhone Safari 播放为 "live streaming",文件大小有限(MySQL、PHP)

Mysql根据从另一个表中选择更新所有行

Codeigniter - 使电子邮件无法被机器人读取

javascript - 带有设置了安全标志的 cookie 的 GET 请求

php - 以性能为导向的方式来保护 PHP 级别的文件?