简体   繁体   中英

mysql database replication error log. Ways to retrieve it

Does mysql logs replication errors? I tried to google around but not much help. If the errors are logged, where is it logged?

Assuming that you are running on a Linux environment, the short answer is that it is liking in the mysql.err file in your logs directory.

A more detailed answer can be found by executing this command

lsof -nc mysqld | grep -vE '(\.so(\..*)?$|\.frm|\.MY?|\.ibd|ib_logfile|ibdata|TCP)'

This will list all files that your database has open. From here you are looking for these two lines:

COMMAND   PID  USER   FD   TYPE      DEVICE  SIZE/OFF     NODE NAME
mysqld  30257 mysql    1w   REG       253,4     10229   270851 /var/log/mysql/mysql.err
mysqld  30257 mysql    2w   REG       253,4     10229   270851 /var/log/mysql/mysql.err

This is showing that, MySQL writes log messages and errors into /var/log/mysql/mysql.err . 1w and 2w are file descriptors 1 ( stdout ) and 2 ( stderr ) and both were redirected from console to the specified file.

More information about the files that appear in that command can be found in this article .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM