N
N
Nastradamus2013-04-25 10:27:04
linux
Nastradamus, 2013-04-25 10:27:04

Sudden errors when importing a database dump with the mysql utility. Is the dump done by mysqldump?

Hello!
Year 3 or 4, a script creates a database dump, and another script on another machine unrolls this dump.
Today I suddenly saw an error when importing a dump:

"ERROR 1064 (42000) at line 11926: 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 'SET @[email protected]@CHARACTER_SET_CLIENT */' at line 7"

The dump is done with mysqldump (perl):
# 1-st step: dump only structure into file:
system "mysqldump -h $dbhost $dbname -u$dbuser -p'$dbpass' --no-data --quick --single-transaction >> $homedir/1.sql";

# 2-nd step: dump DB data without CREATE tables, with ignore some tables

system "mysqldump -h $dbhost $dbname -u$dbuser -p'$dbpass' --quick --single-transaction --no-create-info $ignore_tables
>> $homedir/1.sql
";

and import with the mysql utility :
mysql -u$dbuser -p$dbpass -D $database < $dbfile

MySQL server versions are the same everywhere (5.1.54).
Who knows the reasons for such a mysterious behavior?
Maybe you should use mysqlimport?
upd. I did dump and import again with the same scripts - everything worked fine. What the hell is this? Maybe someone knows the nature of this behavior? Google is talking nonsense about phpmyadmin.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
sirko_el, 2013-04-25
@sirko_el

It looks like you already had something in your $homedir/1.sql file. And this operator >>just added dump requests to the file. Try to use >if you don't need to append

I
int22h, 2013-04-25
@int22h

Those. The bug was once and can not be reproduced?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question