0

I need to move my website with a mysql database on an old server with MySQL 3.23 to a new server with mysql 5.5.20

I have made a mysqldump with gzip and uploaded it to the new server. With gunzip file.sql.gz | mysql -uusername -ppasword dbname I tried to get it working. But I got an error. The error is

ERROR 1064 (42000) at line 4: 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 '-----

CREATE TABLE lite_' at line 1

What should I do to solve this?

Community
  • 1
  • 1
Paul
  • 11
  • 3

1 Answers1

0

For this specific error, remove the -- comment lines in your sql. You can use any of the following:

sed -i '/^--/d' dumpfile.sql
awk '!/^--/' dumpfile.sql > filteredfile.sql
grep -v '^--' dumpfile.sql > filteredfile.sql

You might also ran into type errors for myisam.

mysql error 'TYPE=MyISAM'

Watch out for your type encodings. you could remove all non-ASCII characters from your file

perl -plne 's/[^[:ascii:]]//g' dumpfile.sql

Special characters get lost in MySQL export/import

other notes on 3 to 5 conversion.

http://hisdeedsaredust.com/2009/02/mysql-version-3-to-version-5/

my other notes on mysql are available here:

http://dave.thehorners.com/tech-talk/random-tech/325-mysql

IMHO, mysqlimport should have been written to support output from prior versions.

Community
  • 1
  • 1
Dave Horner
  • 405
  • 5
  • 10