ITPub博客

首页 > 数据库 > MySQL > Mysql 5.7通过mysqldump还原数据库

Mysql 5.7通过mysqldump还原数据库

原创 MySQL 作者:ywxj_001 时间:2017-10-22 12:08:25 0 删除 编辑
[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
还原后的数据库大小




来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/22996654/viewspace-2146221/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
在零售、金融、互联网行业从事数据库相关工作10余年,有丰富的数据库管理和架构的相关经验。 涉及SQLServer、Oracle、MySQL、PostgreSQL等多种数据库。 目前在一家互联网公司担任DBA经理。 负责整个集团数据库的架构设计和管理工作。

注册时间:2010-01-19

  • 博文量
    247
  • 访问量
    436193