Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Mysql ERROR at line 1153: Unknown command '\'

I am trying to import a mysqldump file via the command line, but continue to get an error. I dumped the file from my other server using:

mysqldump -u XXX -p database_name > database.sql

Then I try to import the file with:

mysql -u XXX -p database_name < database.sql

It loads a small portion and then gets stuck. The error I receive is:

ERROR at line 1153: Unknown command '\''.

I checked that line in the file with:

awk '{ if (NR==1153) print $0 }' database.sql >> line1153.sql

and it happens to be over 1MB in size, just for that line.

Any ideas what might be going on here?

like image 618
Chris Avatar asked May 04 '11 19:05

Chris


2 Answers

You have binary blobs in your DB, try adding --hex-blob to your mysqldump statement.

like image 90
miker Avatar answered Sep 17 '22 17:09

miker


You know what's going on - you have an extra single quote in your SQL!O

If you have 'awk', you probably have 'vi', which will open your line1153.sql file with ease and allow you to find the value in your database that is causing the problem.

Or... The line is probably large because it contains multiple rows. You could also use the --skip-extended-insert option to mysqldump so that each row got a separate insert statement.

Good luck.

like image 44
Alain Collins Avatar answered Sep 19 '22 17:09

Alain Collins