mysqldump -h 主机IP -uroot -p --all-database > /data/dball.sql
mysqldump -h 主机IP -uroot -p db1 db2 db3 >/data/db123.sql
mysqldump -h 主机IP -uroot -p db >/data/db.sql
mysqldump -h 主机IP -uroot -p db table1 table2 >/data/db_table12.sql
mysqldump -h 主机IP -uroot -p db table >/data/db_table.sql
mysqldump -h 主机IP -uroot -p db table --where " 查询条件" >/data/db_table.sql
mysqldump -h 主机IP -uroot -p db --ignore-table=logtable --ignore-table=historytable >/data/db_table.sql
mysqldump -h主机IP -d -uroot -p 数据库名 > db.sql
mysqldump -h主机IP -t -uroot -p 数据库名 > db.sql
mysqldump -h -uroot -p --default-character-set=utf-8 --set-gtid-purged=OFF --lock-tables=false -R -E --databases db | gzip > /root/db.sql.gz
--default-character-set=utf-8 指定字符集
--set-gtid-purged=OFF 重新生产GTID,而不用原来的
--lock-tables 不锁表
-R Dump stored routines (functions and procedures)
-E Dump events
gzip 对备份进行压缩
mysqldump -h 主机IP -uroot -p db < /root/db.sql
[root@izbp10lvzs7171weegqj8xz ~]# mysql -uroot -p
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 62669
Server version: 5.7.23-log MySQL Community Server (GPL)
Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
21: root@localhost:[(none)]> use test;
Database changed
21: root@localhost:[test]> source /root/db.sql