In Mysql servers, the following methods can be used to find where the error log file is.
Find where the Error Log is with SELECT
We can find where the error log file is with the “SELECT @@log_error;” command.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
[root@mysqldb1 ~]# mysql -p -u root Enter password: Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 265840 Server version: 5.6.31-ndb-7.4.12-cluster-gpl MySQL Cluster Community Server (GPL) Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> SELECT @@log_error; +------------------------------------------+ | @@log_error | +------------------------------------------+ | /var/lib/mysql/mysqldb1.mysql.local.err | +------------------------------------------+ 1 row in set (0.00 sec) |
Find where the Error Log is with mysql daemon parameter
When the mysql service is started, it will start to work with some parameters defined. One of the mysql daemon parameters “-log-error” parameter indicates the location and name of the error file.
1 2 |
[root@mysqldb1 ~]# ps -ef|grep mysql|grep error mysql 2222 1972 12 Sep26 ? 08:47:49 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --log-error=/var/lib/mysql/mysqldb1.mysql.local.err --pid-file=/var/lib/mysql/mysqldb1.mysql.local.pid |