Home >Operation and Maintenance >CentOS >How to view mysql log files in centos

How to view mysql log files in centos

王林
王林Original
2020-05-18 11:44:308147browse

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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn