When I log into my command line mysql I can no longer access any PHP application that requires a database connection. This happens every time. The steps to cause the issue on my localhost:
当我登录到命令行mysql时,我再也不能访问任何需要数据库连接的PHP应用程序。每次发生这种情况。导致本地主机出现问题的步骤:
Command line:
mysql -u root (no password for localhost)
mysql>
I do not execute or do anything at this point. I load up any page that requires a database connection using root:
我现在不执行或做任何事情。我使用root登录任何需要数据库连接的页面:
PDO::__construct(): send of 108 bytes failed with errno=32 Broken pipe
If I exit mysql the pages come back but another issue comes up when attempting to load two pages at the same time (in browser tabs) it will cause one of them to break until the page loads, then I can refresh
如果我退出mysql,页面会返回,但是当尝试同时加载两个页面时(在浏览器选项卡中)会出现另一个问题,这将导致其中一个页面崩溃,直到页面加载,然后我可以刷新
My.cnf:
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES
wait_timeout=5000
max_allowed_packet=100m
max_user_connections=1000
1 个解决方案
#1
0
Set up wait_timeout
in your MySQL my.cnf
config file:
在MySQL .cnf配置文件中设置wait_timeout:
wait_timeout=3600
wait_timeout = 3600
This config file is located in the /etc/mysql/my.cnf
(Ubuntu/Debian) and /usr/local/mysql/my.cnf
(OSX) and /location of server bin folder/mysql/my.cnf
for windows.
这个配置文件位于/etc/mysql/my.cnf (Ubuntu/Debian)和/usr/local/mysql/my.cnf (OSX)以及/location的server bin文件夹/mysql/my.cnf (windows)。
Restart MySQL server and check this should work.
重新启动MySQL服务器并检查它是否正常工作。
#1
0
Set up wait_timeout
in your MySQL my.cnf
config file:
在MySQL .cnf配置文件中设置wait_timeout:
wait_timeout=3600
wait_timeout = 3600
This config file is located in the /etc/mysql/my.cnf
(Ubuntu/Debian) and /usr/local/mysql/my.cnf
(OSX) and /location of server bin folder/mysql/my.cnf
for windows.
这个配置文件位于/etc/mysql/my.cnf (Ubuntu/Debian)和/usr/local/mysql/my.cnf (OSX)以及/location的server bin文件夹/mysql/my.cnf (windows)。
Restart MySQL server and check this should work.
重新启动MySQL服务器并检查它是否正常工作。