Why do I want to open a database log
When multiple programs are using the database. Our database is sometimes dead. Want to find out why? Found no logs to check. Each program's own logs don't find the key reason. So to open the database log system.
Control Log Size
The prerequisite to open a log is to know how to control the size of the log. This is the general log to face the first problem, or do not know which day the file system to explode, the same egg broken.
Expire_logs_day=3: The number of days the journal is saved. Logs older than three days will be deleted on their own initiative
How do I know if MySQL has a log open?
Run the following statement to view:
Show variables like ' log_% ';
Change the database configuration by turning on the log
Off is not turned on, assuming that you want to enable the following configuration information to be added to the My.ini file in the MySQL root folder (note to add to [mysqld]
Log-error= "D:/log/mysql/mysql_log_err.txt" log= "D:/log/mysql/mysql_log.txt" #log-bin= "D:/log/mysql/mysql_log_bin "Log-slow-queries=" D:/log/mysql/mysql_log_slow.txt "
Description
LOG: Open the query log. This will record each action and detail of the SQL query. Very consumption of database IO, only in the commissioning of a short time to open, usually is not recommended to open.
Log-error: Error Log
Log-bin: Binary Log
Log-slow-queries: A slow query log that records queries that have a query time that exceeds the number of seconds defined by Ong_query_time is recorded in the log file specified by this variable.
Long_query_time=5:5 indicates that the query is more than five seconds before it is recorded in the log specified by Log-slow-queries.
Expire_logs_day=3: The number of days the journal is saved. Logs older than three days will be deleted on their own initiative
Restarting the MySQL service
To see if the log service is turned on
Ability to see log service to start
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy2fsbxjlyxnvbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
viewing log files
Ability to see the generated log files
View Logs
To be able to see what you've just done with the database is logged in the log file.
watermark/2/text/ahr0cdovl2jsb2cuy3nkbi5uzxqvy2fsbxjlyxnvbg==/font/5a6l5l2t/fontsize/400/fill/i0jbqkfcma==/ Dissolve/70/gravity/center ">
Note
- Path does not have spaces
- Backslashes are best written in paths below Linux
- Don't write in a line with the # sign staring at the beginning
Set the size of the log
You certainly don't want the logs to print in real time. Get your file system off the hook.
Configuration of Linux log: http://www.blogjava.net/dongbule/archive/2010/09/04/331050.html Click to open the link
MySQL Log management under Windows (Linux similar) 1.1