恢复MySQL数据库

编程入门 行业动态 更新时间:2024-10-27 14:27:59
本文介绍了恢复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数据库

本文发布于:2023-10-24 07:45:06,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1523346.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:数据库   MySQL

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!