In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)05/31 Report--
Editor to share with you how to open MySQL's binlog log, I believe most people do not know much about it, so share this article for your reference, I hope you can learn a lot after reading this article, let's go to know it!
Binlog is binary log, the binary log file, which records all dml operations of mysql. Through the binlog log, we can do data recovery, master-resident replication and master-slave replication and so on. Developers may not pay much attention to binlog, but it is very important for operators or architects.
How to open the binlog log of mysql?
Add three lines directly to the my.inf main configuration file
Log_bin=ONlog_bin_basename=/var/lib/mysql/mysql-binlog_bin_index=/var/lib/mysql/mysql-bin.index
Three parameters to specify
The first parameter is to open the binlog log
The second parameter is the base file name of the binlog log, followed by an identification to indicate each file.
The third parameter specifies the index file of the binlog file, which manages the directory of all binlog files
Of course, there is also a simple configuration, which can be done with one parameter.
Log-bin=/var/lib/mysql/mysql-bin
The function of this parameter is the same as that of the above three. Mysql will automatically set log_bin to on status according to this configuration, and automatically set the log_bin_index file to the file name you specify followed by .index.
After these configurations, it should be fine for version 5.7 or below, but if we use version 5.7 or above at this time, restarting the mysql service will cause an error. At this time, we have to specify a parameter.
Server-id=123454
Randomly specify a string that cannot have the same name as other machines in the cluster. If there is only one machine, you can specify it at will.
With the above configuration, we can restart our mysql
# CentOS 6service mysqld restart# CentOS 7systemctl restart mysqld
After the boot is successful, we can log in to see if our configuration works
Show variables like'% log_bin%'
Next we can find this catalog and take a look at it.
Since I have already operated the database here, I can see that there are several mysql-bin files and a mysql-bin.index file here. We can open this file and have a look at it.
At this point, our binlog log is opened.
The above is all the contents of the article "how to open the binlog log of MySQL". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!
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.