问题描述
我有一个远程MysqL服务器。尽管超时变量是8小时。它将在约10分钟内失去连接。如下。 (当出现断开连接的提示时,会发出铃声。)
$ MysqL -hxxx.xxx.xxx.xxx -uxxxxx -p -A
Enter password:
Welcome to the MysqL monitor. Commands end with ; or \g.
Your MysqL connection id is 35
Server version: 5.7.19-log MysqL Community Server (GPL)
copyright (c) 2000,2020,Oracle and/or its affiliates. All rights reserved.
Oracle is a registered Trademark of Oracle Corporation and/or its
affiliates. Other names may be Trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MysqL> show global variables like '%timeout';
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| have_statement_timeout | YES |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 60 |
| wait_timeout | 28800 |
+-----------------------------+----------+
13 rows in set (0.02 sec)
MysqL> show variables like '%timeout';
+-----------------------------+----------+
| Variable_name | Value |
+-----------------------------+----------+
| connect_timeout | 10 |
| delayed_insert_timeout | 300 |
| have_statement_timeout | YES |
| innodb_flush_log_at_timeout | 1 |
| innodb_lock_wait_timeout | 50 |
| innodb_rollback_on_timeout | OFF |
| interactive_timeout | 28800 |
| lock_wait_timeout | 31536000 |
| net_read_timeout | 30 |
| net_write_timeout | 60 |
| rpl_stop_slave_timeout | 31536000 |
| slave_net_timeout | 60 |
| wait_timeout | 28800 |
+-----------------------------+----------+
13 rows in set (0.01 sec)
MysqL> show databases;
ERROR 2013 (HY000): Lost connection to MysqL server during query
MysqL> show databases;
ERROR 2006 (HY000): MysqL server has gone away
No connection. Trying to reconnect...
Connection id: 597
Current database: *** NONE ***
+--------------------+
| Database |
+--------------------+
| information_schema |
| xxxxxxx |
| xxxxxxx |
+--------------------+
3 rows in set (0.15 sec)
更新: 感谢@scaisEdge的建议。我发现了奇怪的事情:
如果我以这种方式连接它,则会遇到此问题: (1)通过Windows 7上的SecureCRT到此Windows 7上的VMWare VM CentOS 7.3的SSH (2)MysqL -hxxx.xxx.xxx.xxx -uxxxxx -p -A
如果我以这种方式连接,问题就消失了: (1)通过Windows 7上的SecureCRT到此Windows 7上的VMWare VM CentOS 7.3的SSH (2)ssh xxx@xxx.xxx.xxx.xxx (3)MysqL -hxxx.xxx.xxx.xxx -uxxxxx -p -A
当然,我可以将步骤(3)更改为: MysqL -h127.0.0.1 -uxxxxx -p -A
注意:我跳了几次是因为Windows平台上的MysqL CLI客户端不如Linux上的MysqL客户端好。
尽管似乎可以解决,但这很奇怪。为什么?
可以请一些专家给我一些建议吗?非常感谢!
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)