MySQL 还原

## sql 还原:
mysql -default-character-set=utf8 -h127.0.0.1 -uroot -pxxxxxx test2 < /data/test/db/20190202/test2.sql

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

## souce 还原:
mysql>use test2;
mysql>source /data/test/db/20190202/test2.sql;

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

## 压缩xxx.sql.gz 还原
gunzip < test2.sql.gz | mysql -h127.0.0.1 -uroot -psnail test2 --default-character-set=utf8

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

## 将数据库迁移到新机器:
mysqldump --single-transaction --master-data=2 --default-character-set=utf8 -R -E -q -h127.0.0.1 -uroot -pxxxxxx -P3300 databasename | mysql --default-character-set=utf8 -h114.114.121.1 -uroot -p123 -P3300 -C databasename

-----------------------------------------------------------------------------------------------------------------------------------------------------------------

## GTID 机器迁移库到 非 GTID:
mysqldump --single-transaction --master-data=2 --default-character-set=utf8 -h127.0.0.1 -uroot -pxxxxxx -P3300 test3 --set-gtid-purged=OFF -E -R -q | mysql -h114.67.225.92 -uusername --password=password -P3300 -C test3

上一篇:Maven打包详细流程


下一篇:cocos游戏开发之海岛冒险1