MySQL中的错误1064(42000) [英] ERROR 1064 (42000) in MySQL
问题描述
我试图用从MS SQL Azure数据库创建的数据库转储填充新的MySQL空数据库,但出现以下错误
I am trying to populate a new MySQL empty database with a db dump created from MS SQL Azure database, and I get the following error
第1行的错误1064(42000):您的SQL语法有错误; 检查与您的MySQL服务器版本相对应的手册,以了解 在第1行的"I"附近使用正确的语法
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执行此操作,并在命令提示符下使用类似于以下命令的命令:
I used mysqldump to perform this operation and used command similar to the following in the command prompt:
mysql --user=rootusername --pasword=password databasename < dumpfilename.sql
Mysqldump花费了大约30分钟来显示此错误消息.
Mysqldump took about 30 minutes to display this error message.
推荐答案
(对于那些来自搜索引擎的问题),请检查您的存储过程是否声明了自定义分隔符,因为这是您可能会在看到的错误引擎无法弄清楚如何终止一条语句:
(For those coming to this question from a search engine), check that your stored procedures declare a custom delimiter, as this is the error that you might see when the engine can't figure out how to terminate a statement:
第3行的错误1064(42000):您的SQL语法有错误; 检查与您的MySQL服务器版本相对应的手册 在行的''附近使用正确的语法...
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…
如果您有数据库转储,请参见:
If you have a database dump and see:
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
包装:
Try wrapping with a custom 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中的错误1064(42000)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!