Today, when I visited the MySQL project, I suddenly reported a 500 error, no connection was found, so I thought of MySQL connection time.
Mysql> show global variables;
The main thing is that the connection time is 28800 (8 hours), and the Task Scheduler is not open, so think of modifying the value of the global variable.
1. Modify the Task Scheduler pack:
1.1 Specific view task scheduling status:show variables like '%event% ';
1.2 Modify task Open state:set global event_scheduler=on;
2. Modify the database connection time:
2.1 Viewing Connection time:show variables like '%timeout% ';
Find default Hold Time is 2880 (8 hours)
2.2 Modify Connection time:
MySQL>set global wait_timeout=6048000 rows affected ( 0.00 sec) MySQL>set global interactive_timeout=604800 0 rows affected (0.00 sec)
2.3. Check the connection time:show variables like '%timeout% ';
The discovery seems to have not taken effect. in this session the variable does not take effect and needs to exit after entering to view the MySQL variable to take effect. That is, log out of MySQL again and find that the configuration is in effect.
3. Restarting the MySQL server found that it did not work (modify/ETC/MY.CNF to make variable start effective)
Remember to modify the my.cnf file to allow MySQL to change the value of the variable after restarting, it is important to note that using SET global setting MySQL variable value needs to be configured at the time
Write down this variable under the [mysqld] stack in the my.cnf file, or MySQL will restart.
Reboot found three variables are in effect, modify MySQL startup default value need to modify/ETC/MY.CNF file
Summarize:
Finally in the MY.CNF also has the location of the MySQL log file, that is, the default configuration of MySQL is modified, only need to modify the MY.CNF, if you view the default value of MySQL is the above show variables like '%...% '
Therefore, it is also associated with the initial installation of MySQL server to modify the default encoding of MySQL in my.cnf, reference: http://www.cnblogs.com/qlqwjy/p/7504865.html
Modify the configuration of MySQL to see what global variables the current version of MySQL has, different versions of the MySQL global variables, know which variables correspond to modify their value to the desired value
MySQL variable modified and effective under Linux