Home > Article > Operation and Maintenance > How to view mysql log files in centos
Mysql does not allow us to view the log by default, so we need to change some settings to view it.
1. Change the configuration file and allow users to view the log file
sudo vi /etc/mysql/mysql.conf.d/mysqld.cnf
Delete the # in front of lines 68 and 69
2. Restart the mysql service
sudo service mysql restart
3. Enter the /var/log/mysql/ directory
cd /var/log/mysql/
You can view the mysql log files in this directory.
Always check the log file command: When the log changes, you can always see it in the terminal
sudo tail -f /var/log/mysql/mysql.log
Recommended tutorial: centos tutorial
The above is the detailed content of How to view mysql log files in centos. For more information, please follow other related articles on the PHP Chinese website!