MySQL mysqldump and mysqlbinlog backup and restore tutorials
Let's learn about MySQL mysqldump and mysqlbinlog backup and restore tutorials, I believe you will benefit a lot after reading, the text in the essence is not much, hope that MySQL mysqldump and mysqlbinlog backup and restore tutorials this short content is what you want.
1. Use mysqlbinlog to make continuous backups of binary logs:
Mysqlbinlog-u root-p-R-host='localhost'-- raw-- stop-never mysql_bin.000001
two。 Use mysqldump to create dump files as snapshots of CVM data, and execute mysqldump commands periodically to create updated snapshots as needed:
Mysqldump-u root-p-- host='localhost'-B test-- events-- routines-- master-data=2 > test.sql
3. Insert data:
Insert into person (name) values ('Gao Yu'), ('Bruce Lee'), ('giant')
4. Simulated CVM crashes and test database data is lost
Stop continuously backing up log binaries and delete test libraries
Drop database test
5. Restore the data using the latest dump file:
Mysql-- host='localhost'-u root-p < test.sql
6. Use a binary log backup to re-execute events written after the coordinates listed in the dump file. Suppose the coordinates in the file are as follows:
Cat test.sql
Mysqlbinlog-- start-position=11125 mysql_bin.000001 | mysql-- host='localhost'-u root-p
View data: select * from peison
After reading this article on MySQL mysqldump and mysqlbinlog backup and restore tutorials, many readers will want to know more about it. For more industry information, you can follow our industry information section.