尝试备份/恢复mysql数据库时出错 [英] Error while trying backup/restore mysql database

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

问题描述



我使用了这个 恢复/备份的解决方案。



但尝试恢复时出现此错误(在数据库中创建存储过程后):


I used this solution to restore/backup .

but this error appears while trying a restore (after I created a stored procedure in the database ):

string SalesDB = "ee/dw/dd/db/DB.sql";
                   using (MySqlConnection con = new MySqlConnection(myconn.sales_Coonn))
                   {
                       using (MySqlCommand cmd = new MySqlCommand())
                       {
                           using (MySqlBackup mb = new MySqlBackup(cmd))
                           {
                               cmd.Connection = con;
                               con.Open();
                               mb.ImportFromFile(SalesDB);
                               con.Close();
                           }
                       }
                   }





MySql.Data.MySqlClient.MySqlException: '你的SQL语法有错误;查看与MySQL服务器版本对应的手册,以便在第3行''附近使用正确的语法。









尝试备份时出现此错误:p:



MySql.Data。 Types.MySqlConversionException:无法将MySQL日期/时间值转换为System.DateTime



我尝试过:



我可以从Workbench(MySQL服务器5.7.21)成功导入/导出它。



当我删除存储过程时,我可以成功导入它。



所有存储过程如下:



MySql.Data.MySqlClient.MySqlException: 'You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 3'




and this error appears while trying backup: p :

MySql.Data.Types.MySqlConversionException: Unable to convert MySQL date/time value to System.DateTime

What I have tried:

I can import/export it successfully from Workbench (MySQL server 5.7.21 ).

also when I deleted a stored procedure, I could import it successfully.

all of the stored procedure like this :

CREATE DEFINER=`root`@`localhost` PROCEDURE `getItemsDataByID`(in ID int)
BEGIN
SELECT * FROM st_items where stitems_ID=ID;
END

推荐答案

首先查看备份文件的内容:它看起来有效吗?

如果不是,你需要查看生成该文件的应用程序 - 我们无法访问它。

如果是,请将其加载到数据库管理中app作为查询,并通过自下而上的评论将其删除。当它运行时,添加一点。当它停止时,看看你添加的最后一位,看看你是否能发现语法错误。



我们不能为你做任何 - 我们无法访问备份文件,服务器或代码!
Start by looking at the content of the backup file: is it valid looking SQL?
If it isn't, you need to look at your app that produced the file - and we don't have access to that.
If it is, load it into your database management app as a query and cut it down by commenting out from the bottom up. when it runs, add a bit back. when it stops, look at the last bit you added back and see if your can spot the syntax error.

We can't do any of that for you - we don't have access to the backup file, the server, or your code!


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

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