mysql backup and restore primary

*, How to check whether binlog is enabled in mysql

The first: execute show binary logs after logging in;
When a teenager sees this You are not using binary logging, it means that you have not turned it on, haha
The second: execute show variables like 'log_bin' after logging in;
When a teenager sees the off keyword, it means that you have not opened the backup, haha
In silent mourning

 

*, How to open and close binlog in mysql

Open
Step 1: Open the MySQL\ProgramData\my.ini file
Step 2: Modify the value of the log-bin variable - give a directory like *.log without spaces at the end
restart mysql
Check if *.000001 and *.index backup log files are generated
closure
Just comment out the log-bin variable

 

*, mysql view binlog events

Execute show binlog events

 

*, MySQL to view the location of the last binlog file

Execute show master status

 

*, mysql enable to create a new binlog file

Execute flush logs

 

*, mysql output backup content to sql

mysqlbinlog --start-date="2016-01-20 03:30:00" --stop-date="2016-01-20 22:00:00" logmysql.000001 > test.sql
Sometimes you may need this
mysqlbinlog --start-datetime="2016-01-20 03:30:00" --stop-datetime="2016-01-20 22:00:00" logmysql.000001 > test.sql  

 

*, mysql recovery command

待定1-mysqlbinlog mysql-bin.000006 --start-position=2471 --stop-position=2876 | mysql -u root -p
待定2- mysqlbinlog  --start-date="2012-10-15 16:30:00" --stop-date="2012-10-15 17:00:00" mysql_bin.000001 |mysql -u root -p

 

-------------------------------------------------- -----------Unknown Territory------------------------------------ ----------------------

*, view mysql engine

show engines;
The general default is InnoDB

 

*, a URL for reference only (single table recovery summarized by others)

http://www.cnblogs.com/billyxp/p/3460682.html

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326449174&siteId=291194637