Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't set mysql wait_timeout in ubuntu at path /etc/my.cnf

Tags:

mysql

ubuntu

I am facing an error of "Broken Pipe" in mysql database connection. That error appear when the server isn't accessed by anyone till 8 hours, the connection is timeout and can't connect to mysql database server. I find and try many way for that error. In that, setting wait_timeout variable from 28800 to 86400 (means 8 hours to 24 hours). In that, I had copied my.cnf file from etc/mysql/my.cnf to etc/my.cnf to set user specification value and add variable like :

[mysql]
wait_timeout = 86400
interactive_timeout = 86400

But when I login to mysql with command mysql -u root -p, the following error is shown: mysql: unknown variable 'wait_timeout=86400'

How can I set wait_timeout variable in ubuntu linux server. Pls

like image 488
Aung Thet Avatar asked Oct 30 '25 16:10

Aung Thet


1 Answers

Try placing

wait_timeout = 86400
interactive_timeout = 86400

under [mysqld] ie,

[mysqld]
wait_timeout = 86400
interactive_timeout = 86400

and restart mysql server.

like image 137
Sunil Goli Avatar answered Nov 01 '25 06:11

Sunil Goli



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!