我已经使用名为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数据库
发布评论