Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
313 views
in Technique[技术] by (71.8m points)

mysql - 如何从mysqldump恢复转储文件?(How do I restore a dump file from mysqldump?)

I was given a MySQL database file that I need to restore as a database on my Windows Server 2008 machine.

(我获得了一个MySQL数据库文件,需要将其还原为Windows Server 2008计算机上的数据库。)

I tried using MySQL Administrator, but I got the following error:

(我尝试使用MySQL Administrator,但出现以下错误:)

The selected file was generated by mysqldump and cannot be restored by this application.

(所选文件是由mysqldump生成的,不能由该应用程序还原。)

How do I get this working?

(我该如何工作?)

  ask by Zack Peterson translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

If the database you want to restore doesn't already exist, you need to create it first.

(如果要还原的数据库尚不存在,则需要首先创建它。)

On the command-line, if you're in the same directory that contains the dumped file, use these commands (with appropriate substitutions):

(在命令行上,如果您位于包含转储文件的目录中,请使用以下命令(带有适当的替换):)

C:> mysql -u root -p

mysql> create database mydb;
mysql> use mydb;
mysql> source db_backup.dump;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...