Re: URGENT - Dump file won't restore. Syntax Errors????
I found the answer myself.
The problem is the DEFAULT portion of the create line. There is nothing after the keyword DEFAULT so it expands out to a command that has an error in it.
This is how a correct line looks:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test_aboutthatmovie_info` /*!40100 DEFAULT CHARACTER SET utf8 */;
This is one that causes a syntax error
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test_aboutthatmusic_info` /*!40100 DEFAULT */;
I don't know why mysqldump puts that command there when there is no default character set. But you can get rid of it easily no matter how large your dump file (although it is slow on big files).
I have a script that backs up ALL of my databases automatically and it adds some edtra code to the top/bottom of each dump file. I just added this line to my script so it removes the offending DEFAULT command if it exists.
sed -i 's/\/\*!40100 DEFAULT \*\// /gi' test_aboutthatmusic.sql
Here is what the corrected line look like after the SED command runs:
CREATE DATABASE /*!32312 IF NOT EXISTS*/ `test_aboutthatmusic_info` ;