MySQL中的错误1064(42000)
作者:互联网
我试图使用从MS SQL Azure数据库创建的数据库转储填充新的MySQL空数据库,我收到以下错误
ERROR 1064 (42000) at line 1: 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 ‘I ‘ at line 1
我使用mysqldump来执行此操作,并在命令提示符中使用类似于以下命令:
mysql --user=rootusername --pasword=password databasename < dumpfilename.sql
Mysqldump花了大约30分钟来显示此错误消息.
解决方法:
(对于那些从搜索引擎来到这个问题的人),检查你的存储过程是否声明了一个自定义分隔符,因为这是当引擎无法弄清楚如何终止语句时可能会看到的错误:
ERROR 1064 (42000) at line 3: 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…
如果您有数据库转储,请参阅:
DROP PROCEDURE IF EXISTS prc_test;
CREATE PROCEDURE prc_test( test varchar(50))
BEGIN
SET @sqlstr = CONCAT_WS(' ', 'CREATE DATABASE', test, 'CHARACTER SET utf8 COLLATE utf8_general_ci');
SELECT @sqlstr;
PREPARE stmt FROM @sqlstr;
EXECUTE stmt;
END;
尝试使用自定义DELIMITER包装:
DROP PROCEDURE IF EXISTS prc_test;
DELIMITER $$
CREATE PROCEDURE prc_test( test varchar(50))
BEGIN
SET @sqlstr = CONCAT_WS(' ', 'CREATE DATABASE', test, 'CHARACTER SET utf8 COLLATE utf8_general_ci');
SELECT @sqlstr;
PREPARE stmt FROM @sqlstr;
EXECUTE stmt;
END;
$$
DELIMITER ;
标签:mysql-error-1064,azure,mysql 来源: https://codeday.me/bug/20191004/1852312.html