In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article will explain in detail what documents mysql-bin refers to. The editor thinks it is very practical, so I share it for you as a reference. I hope you can get something after reading this article.
The mysql-bin of mysql is the operation log file of the database, which is basically useless if you don't do master-slave replication.
For example, UPDATE a table, or DELETE some data, even if the statement does not have matching data, this command will be stored in the log file, including the execution time of each statement, will also be recorded.
This is done for the following two main purposes:
1: data recovery if there is something wrong with your database and you have a backup before, you can look at the log file to find out which command caused the problem with your database and find a way to recover the loss.
2: synchronizing data between master and slave servers all the operations on the master server are in the log, and the slave server can carry out according to the log to ensure the two synchronization. For example: when a single mysql server service is used, you can comment out the corresponding log-bin=/program/mysql/mysql-bin item, add the "#" sign, and then restart the mysql service.
How do I delete a mysql-bin file?
By default, mysql will keep the mysql-bin file all the time, so that at a certain time, the disk may be full. Although the file is useless, it is not recommended to delete it with the rm command, which may not be safe. The correct way is to delete it through the command of mysql.
Mysql-u root-pEnter password: Welcome to the MySQL monitor. Commands end with; or\ g.Your MySQL connection id is 2819416Server version: 5.5.24-0ubuntu0.12.04.1-log (Ubuntu) Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trademark of Oracle Corporation and/or itsaffiliates. Other names may be trademarks of their respectiveowners.Type 'help;' or'\ h' for help. Type'\ c'to clear the current input statement.mysql > reset master;Query OK, 0 rows affected (3 min 37.65 sec)
In fact, the key command is reset master;, which empties the mysql-bin file.
In addition, if your mysql server does not need to do master-slave replication, it is recommended to modify the my.cnf file to set not to generate these files, just delete the following line in my.cnf.
Log-bin=mysql-bin
If you need to copy, it is best to control the number of days these log files are retained. You can set the number of days to retain these log files by using the following configuration:
Expire_logs_days = 7
Means to keep the log for 7 days, so that the old log will be cleaned up automatically.
About mysql-bin refers to what the file is shared here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.
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.