mysql备份恢复出错_尝试备份/恢复mysql数据库时出错

bd96500e110b49cbb3cd949968f18be7.png

hi,

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: '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

解决方案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!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值