Mysql5.7怎么通过mysqldump还原数据库

发布时间:2021-08-23 15:07 来源:亿速云 阅读:0 作者:chen 栏目: Mysql 欢迎投稿:712375056

这篇文章主要讲解了“5.7怎么通过mysqldump还原数据”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“Mysql5.7怎么通过mysqldump还原数据库”吧!

[root@test tmp]# du -sh test.sql
17G     test.sql
mysqldump备份的文件

[root@test ~]# mysql -uroot -ptestpassword --default-character-set=utf8 test < /tmp/test.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
ERROR 1049 (42000): Unknown database 'test'
报错

MySQL [(none)]> create database test;
Query OK, 1 row affected (0.00 sec)

[root@test ~]# mysql -uroot -ptestpassword --default-character-set=utf8 test < /tmp/test.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
还原完成

[root@test ~]# mysql -uroot -p数据库密码 --default-character-set=utf8 数据库 < /tmp/pousheng_b2b2c_prepub2017101.sql
mysql: [Warning] Using a password on the command line interface can be insecure.

数据库文件都在这个目录下:
[root@test mysql]# pwd
/data/mysql

[root@test mysql]# du -sh test
23G     test
还原后的数据库大小

免责声明:本站发布的内容(图片、视频和文字)以原创、来自本网站内容采集于网络互联网转载等其它媒体和分享为主,内容观点不代表本网站立场,如侵犯了原作者的版权,请告知一经查实,将立刻删除涉嫌侵权内容,联系我们QQ:712375056,同时欢迎投稿传递力量。