Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to realize mysqldump simple backup and recovery

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

The following is mainly to bring you mysqldump simple backup recovery is how to achieve, I hope these contents can bring you practical use, this is also my edit mysqldump simple backup recovery is how to achieve the main purpose of this article. Okay, no more nonsense, let's go straight to the following.

backup tool

1. mysqldump: mysql's own backup tool, which belongs to logical backup;

2、cp/tar

3. xtrabackup: open source tool, supporting hot backup of InnoDB, belonging to physical backup;

mysqldump

mysqldump is a tool that comes with mysql. Its backup strategy is full backup + binary log. Support hot standby or warm standby for InnoDB and near warm standby for MyISAM.

How to use:

mysqldump [OPTIONS] database [tables] for i in {1.. 20};do mysql -e "insert into test.student(id,name,age,sex)values('$i','student$i','$[$RANDOM%80+18]','${GENDER[$RANDOM%2]}')";done

2. Authorized user rights

> GRANT ALL ON test.* TO root@'192.168.32.% ' IDENTIFIED by 'centos';

3. Backup data

h3]#mysqldump -uroot -pcentos -h292.168.32.111 --single-transaction -R --triggers -E --databases test >/app/test.sql

4. Recovery of data

]#mysql < test.sql

The second method of recovery, put the script in a directory where any user has permission to read, and enter the database to adapt to the source to read the file directly.

summary

mysqldump only supports full backup. What about data that changes after backup? You'll have to use binary logs. But again, we don't know where the binary logs are after a full backup, and we can't restore them all. Here you can add an option--master-data when backing up, this statement will be executed, it is best to choose 2 comments do not execute. One drawback of mysqldump is that it does not support delta and incremental backups.

For the above on mysqldump simple backup recovery is how to achieve, we do not think very helpful. If you need to know more, please continue to pay attention to our industry information, I believe you will like these contents.

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.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report