MySQL Log File Location on Redhat/CentOS Linux Server

MySQL Log File Location on a Redhat/CentOS/Fedora Linux Server

 

On Redhat/CentOS Server mySQL log will be saved in /var/log directory. Check /var/log directory for mySQL log files.

MySQL log file on Redhat/CentOS Server : /var/log/mysqld.log

On some servers mySQL logs might be in a different location. Do the below steps to find out mySQL log file location if you didn’t see the logs in the above default location.

Log into your Linux Server via SSH as root and run the below command to check the mySQL error log file location. The error log and mySQL general log might be already set in the my.cnf file. Run the command “cat my.cnf” to view the content of mySQL configuration file. Do the below steps if you didn’t see any log file location set in my.cnf file.
 

root@server [~]# mysqladmin variables | grep log_error
| log_error | /var/lib/mysql/server.err

 
On the above server mySQL error logs are saved in the file /var/lib/mysql/server.err

Type the below command to check the mySQL general_log_file location.
 

root@server [~]# mysqladmin variables | grep general_log_file
| general_log_file | /var/lib/mysql/server.log

 

mySQL log File location on Linux Server

mySQL log File location on Linux Server


 
mysql error log file location on linux Server

mysql error log file location on linux Server


 
On my server mySQL error log files and general log file are saved in the above location.

Run the below command to check the slow query log location on Redhat Server.
 

root@server [~]# mysqladmin variables | grep slow_query_log_file
| slow_query_log_file | /var/lib/mysql/server-slow.log

 

MySQL slow query log file Location Redhat CentOS Server

MySQL slow query log file Location Redhat CentOS Server