恢复MySQL数据库 [英] restoring a MySQL database

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

问题描述

我已经使用名为library的数据库的mysqldump实用程序创建了一个名为ab.sql的文件.工作正常.现在,我正在尝试使用mysqlimport还原它. 我的数据库已经存在.但我想重写它.我在用 命令

I have created a file named ab.sql using the mysqldump utility of a database named library. It worked fine. Now i am trying to restore it using mysqlimport. My database already exists. But i want to override it. I am using the command

mysqlimport -uroot -p**** library D:/ab.sql

在命令行中,但显示错误消息,

in the command line but it gives an error that says,

mysqlimport:错误:1146,使用表:ab时,表'library.ab'不存在

mysqlimport: Error: 1146, Table 'library.ab' doesn't exist, when using table: ab

迫切需要帮助.

推荐答案

mysqlimport将文本文件中的行读取到数据库中. mysqldump输出一个充满SQL语句的文件,而不是简单的行.您可以使用以下命令运行这些SQL语句:

mysqlimport reads rows from a text file into a database. mysqldump outputs a file full of SQL statements, not simple rows. You can run those SQL statements using:

mysql -u root < D:/ab.sql

根据您的mysqldump选项,这可能会删除数据库中的现有数据.如果您不确定,我会为"drop"和"delete"设置grep,以确保它看起来还可以.

Depending on your mysqldump options, this may delete existing data in your database. If you're unsure, I'd grep for "drop" and "delete" to make sure it looks OK.

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

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