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