mysql,dump,数据库还原 [英] mysql, dump, database restore

查看:137
本文介绍了mysql,dump,数据库还原的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用以下命令转储了我的数据库:

  mysqldump -uuser -ppassword db_name>文件

然后我完全删除了我的数据库:

  drop database db_name; 

那么我创建了一个新的数据库:

  create database db_name; 

,然后我尝试使用以下命令恢复db:

  mysqldump -uuser -ppassword db_name<文件

问题是dump不会创建表并在其中加载数据,因此数据库保持为空

>解决方案

mysqldump用于转储数据库。您创建了一个新的空数据库,然后转储该空数据库。 mysql 而不是重新载入您的转储

  mysqldump db& dump.sql 
mysql drop / create
mysql db< dump.sql

将是基本命令序列。


I have dumped my database with the following command:

mysqldump -uuser -ppassword db_name > file

then I completely removed my database:

drop database db_name;

then I created a new database:

create database db_name;

and then I tried to restore the db with the following command:

mysqldump -uuser -ppassword db_name < file

The problem is that dump does not create tables and loads data in them and so the database remains empty however it does show a message like dump completed "date time"

What could be the reason for this?

解决方案

mysqldump is for dumping the database. You've created a new empty database, and then dumped that empty database. Use mysql instead to reload your dump

mysqldump db > dump.sql
mysql drop/create
mysql db < dump.sql

would be the basic command sequence.

这篇关于mysql,dump,数据库还原的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆