MySQL Forums
Forum List  »  InnoDB

Re: URGENT - Dump file won't restore. Syntax Errors????
Posted by: Glenn Schworak
Date: August 22, 2012 06:22PM

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

Options: ReplyQuote


Subject
Views
Written By
Posted
Re: URGENT - Dump file won't restore. Syntax Errors????
1409
August 22, 2012 06:22PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.