Log type for MySQL:
Error log: Log-error
Query log: Log
Slow query log: log-slow-queries
Update log: Log-update
Binary log: Log-bin
Turn on the error log
log-error=/usr/local/mysql/log/log-error. Log
Start query Log
log=/usr/local/mysql/log/log-query. Log
Turn on slow query log
log-slow-queries=/usr/local/mysql/log/log-slow-query. Log
Turn on the update log
log-update=/usr/local/mysql/log/log-update. Log
Open Binary Log
log-bin=/usr/local/mysql/log/log-bin. Log
Instance test: Turn on query log, error log
1, edit the/ETC/MY.CNF, that is, edit the MySQL configuration file
Vi/etc/my.cnf
2. Add code snippet to open query log and error log
3. Restart MySQL Database
4, enter the command, real-time view Log-query.log file
Tail-f/usr/local/mysql/log/log-query. Log
5. Open another terminal and go to MySQL for query operation.
1 MySQL -uroot-p12345623 use test45 SELECT * from one;
6, the implementation of step 5 o'clock, the contents of Log-query.log will be changed
Issue: In the/usr/local/mysql/log/folder, there are log-error.log files, but there are no log-query.log files.
Cause: In the Log-error.log file, find the error prompt. I understand that there is no permission to create a file. However, how to have permission to create log-error.log files, really tangled.
FIX: Create a Log-query.log file yourself and set the permissions to 777 (a bit violent)
MySQL log viewing and opening