Mysql备份及恢复

备份远程机器192.168.100.100上test数据库test表结构及数据

mysqldump -h192.168.100.100 -uroot -proot --databases test --tables test > test.sql 

备份表结构 --no-data

mysqldump -h192.168.100.100 -uroot -proot --databases test --tables test  --no-data > test.sql 

只备份表数据 -t

mysqldump -t -h192.168.100.100 -uroot -proot --databases test --tables test > test.sql

如果要备份多数据库或多张表

数据库或表名中间加空格 

恢复

mysql -uroot -proot -A 登录数据库

source /home/sql/test.sql

posted @ 2021-03-07 17:38  春秋纪元  阅读(45)  评论(0)    收藏  举报