mysqldump备份脚本

2017-02-27  本文已影响0人  jsdjl
mysqldump -uroot -p --single-transaction --flush-logs -R -E  --all-databases --set-gtid-purged=off --master-data=2  >/root/backup-`date +%F-%H-%M-%S`.sql
mysqldump -uroot -p --single-transaction --flush-logs -R -E   --databases DB_NAME --set-gtid-purged=off --master-data=2  >/root/backup-`date +%F-%H-%M-%S`.sql
mysqldump -uroot -p --single-transaction --flush-logs -R -E  -B DB1 DB2 --set-gtid-purged=off --master-data=2  >/root/backup-`date +%F-%H-%M-%S`.sql
mysqldump  --databases DB_NAME  --no-data --single-transaction --flush-logs --set-gtid-purged=off > /root/backup-`date +%F-%H-%M-%S`.sql
mysqldump   DB_NAME  --no-data table1  table2    --single-transaction --flush-logs   --skip-dump-date --set-gtid-purged=off --master-data=2  > /root/backup-`date +%F-%H-%M-%S`.sql
mysqldump    DB_NAME   -t    --single-transaction --flush-logs    --set-gtid-purged=off --master-data=2  > /root/backup-`date +%F-%H-%M-%S`.sql
mysqldump    DB_NAME   -t  table1 table2  --single-transaction --flush-logs    --set-gtid-purged=off --master-data=2  > /root/backup-`date +%F-%H-%M-%S`.sql
mysqldump   DB_NAME   table1  table2   --single-transaction --flush-logs  --set-gtid-purged=off --master-data=2  > /root/backup-`date +%F-%H-%M-%S`.sql
select * from t_user  into outfile '/tmp/t_user.csv' fields terminated by ',' optionally enclosed by  '"' escaped by '"' lines terminated by '\r\n';
load data infile  '/tmp/t_user.csv' into table table_name fields terminated by ',' optionally enclosed by  '"' escaped by '"' lines terminated by '\r\n';

1.select version();--版本需求
2.show variables like 'gtid%'; --set-gtid-purge=off
3.新库set global log_bin_trust_function_creators=1;
4.倒入单库 mysql -uroot -p DB_NAME < /root/BACKUP.sql

上一篇 下一篇

猜你喜欢

热点阅读