windows and linux ways to enable log management after installing mysql
- 2020-06-07 05:27:09
- OfStack
Check to see if logging is enabled
mysql>show variables like 'log_bin';
How do I know the current log
mysql> show master status;
Show the number of base 2 logs
mysql> show master logs;
Look at the base 2 log file using mysqlbinlog
shell>mysqlbinlog mail-bin.000001
or
shell>mysqlbinlog mail-bin.000001 | tail
Specify the exit location for log in the configuration file.
Windows: Windows's configuration file is my.ini, 1 normally under MySQL's installation directory or c:\Windows.
Linux: The configuration file for Linux is ES33en. cnf, 1 generally under /etc.
Summary of log file types:
1. Error logging records problems that occur when mysqld is started, run, or stopped.
My. ini Configuration information:
#Enter a name for the error log file. Otherwise a default name will be used.
#log-error=d:/mysql_log_err.txt
2. The query log records the client connections made and the statements executed.
My. ini configuration information:
#Enter a name for the query log file. Otherwise a default name will be used.
#log=d:/mysql_log.txt
3. The update log records statements that change data. Use of this log is disapproved.
My. ini Configuration Information:
#Enter a name for the update log file. Otherwise a default name will be used.
#log-update=d:/mysql_log_update.txt
4.2 Base logging statements for all changed data. It's also used for replication.
My. ini Configuration information:
#Enter a name for the binary log. Otherwise a default name will be used.
#log-bin=d:/mysql_log_bin
5. Slow logging records all queries whose execution time exceeds long_query_time seconds or queries that do not use indexes.
My.ini Configuration information:
#Enter a name for the slow query log file. Otherwise a default name will be used.
#long_query_time =1
#log-slow-queries= d:/mysql_log_slow.txt
linux under:
Enter in [mysqld]
mysql> show master status;
0
Under the windows
Enter in [mysqld]
## Startup log
log="E:/wamp/MySql/mysql_log/mysql.log"
## The error log
log-error="E:/wamp/MySql/mysql_log/mysql.logerror.log"
## It's how long it lasts sql Will be log Come down here 2 seconds
long_query_time=2
## Slow query log
log-slow-queries= "E:/wamp/MySql/mysql_log/slowquery.log"
long_query_time =2 -- It's how long it lasts sql Will be log Come down here 2 seconds
log-slow-queries= /usr/local/mysql/log/slowquery.log -- Record queries that return slower statements
log-queries-not-using-indexes = nouseindex.log -- Which literally means, log No index is used down here query
log=mylog.log -- Record all executed statements