In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
The following is mainly about how to manage mysql logs. I hope these contents can bring you practical use, which is also the main purpose of this article on how to manage mysql logs. All right, don't talk too much nonsense, let's just read the following.
Mysql log
Error log: record the startup, shutdown and running errors of mysql CVM
Binary log: all operations in the database except select (the most important log) are recorded as binary files.
Query log: recording query information
Slow query log: records operations that take more than a specified time to execute
Relay log: the slave database copies the log of the master database to its own relay log (used for master-slave replication)
General log: audit that account and what was done at what time
Transaction log or redo log: records innodb transactions related such as transaction execution time, checkpoints
Binary log bin-log
Enable
Vim / etc/my.cnf / / Edit the mysql main configuration file
[mysqld]
Log-bin [= dir\ [filename]] / / just add this line
Service mysqld restart / / restart the mysq process
Mysql > set sql_log_bin=0; / / stop
Mysql > set sql_log_bin=0; / / enable for current session only
View the log
View all:
# Mysqlbinlog mysql.000002
View by time
# Mysqlbinlog mysql.000002-- start-datetime= "2012-12-05 10:02:56"
# Mysqlbinlog mysql.000002-- stop-datetime= "2012-12-05 11:02:56"
# Mysqlbinlog mysql.000002-- start-datetime= "2012-12-05 10:02:56"-- stop-datetime= "2012-12-05 11:02:56"
View by byte
# Mysqlbinlog mysql.000002-start-position=260
# Mysqlbinlog mysql.000002-stop-position=260
# Mysqlbinlog mysql.000002-start-position=260-stop-position=930
Two ways to truncate bin-log (to generate a new bin-log file)
1) restart mysql CVM
2) # mysql-uroot-p123mure'flush logs'
Delete bin-log Fil
# mysql-uroot-P123-e 'reset master'
General query log
Enable
Vim / etc/my.cnf / / Edit the mysql main configuration file
[mysqld]
Log [= dir\ [filename]] / / just add this line
Service mysqld restart / / restart the mysq process
Slow query log
Enable
Vim / etc/my.cnf / / Edit the mysql main configuration file
[mysqld]
Log-slow-queries [= dir\ [filename]]
Long_query_time=n / / just add these two lines
Service mysqld restart / / restart the mysq process
View slow query log
Test: benchmark (count,expr)
Select benchmark (500000000); / / execute 2p3s 5000000000 times
Summary: mysql log management, binary log is the most important, it can be used to restore the database based on point in time, and binary log file is the key to mysql master-slave replication.
For the above about how to manage mysql logs, you do not find it very helpful. If you need to know more, please continue to follow our industry information. I'm sure you'll like it.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.