MySQL dump compatibility issue (from 4.0.26 into 5.5.41) - mysql

I am trying to transfer data from MySQL 4.0.26 into MySQL 5.5.41-0ubuntu0.12.04.1.
I am making a dump from MySQL 5.5 server via mysqldump it works but when I'm trying to restore it there a problem occures:
ERROR 1064 (42000) at line 20: 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 'TYPE=MyISAM' at line 4
Is there some way how to create compatible dump for MySQL 5.5. from MySQL 4.0?

This should work
mysqldump ... | sed 's/TYPE=/ENGINE=/g' | > dump_file
(...and be enough. In the link Jens posted, there's another substitute for timestamp(14), but MySQL does this automatically, if I'm not mistaken.)

Related

mysqldump error while copying database from server to another

I'm trying to copy database from one server to another like this
mysqldump -u<source_db_username> -p<source_db_password> -h<source_db_ip_address> source_database_name
| mysql -u<target_db_username> -p<target_db_password> -h<aws_rds_endpoint> <aws_rds_db_name>;
But I get
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 'mysqldump -u<source_db_username> -p<source_db_password>
-h<source_db_ip_address> source_database_name ' at line 1
I shouldn't use the database while copying I just have to refer the mysql location to use it and shouldn't use ';' at the end of the command it's working now.

Error while Importing MySQL dump into Aurora

I took a dump of my RDS MySQL database(5.7) with utf8 as character set and collation. Intent is to migrate the database to Aurora 5.6. During the import, I see an error where it complains about the query being incorrect. Now this is the dump file that mysql generated so my guess is that its having problem inserting the data in question. I checked for that data string in the dump and it does exist but I see nothing wrong in it. Here's the error I get during import. Any pointers ?
ERROR 1064 (42000): 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 ''2352eb05-7596-3' at line 1

Backwards compatible mysql dump

I am trying to port a database from mysql 5.7 to mysql 5.5.
At first, I used the following command
mysqldump -u root -p --all-databases > alldbs.sql
When I try to import the DB in mysql 5.5 I keep getting errors like
ERROR 1064 (42000) at line 572: 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 'STATS_PERSISTENT=0' at line 9
where it complains about STATS_PERSISTENT=0 statement.
Then I tried
mysqldump -u root -p --compatible=mysql40 --all-databases > alldbs.sql
but this just gives me
ERROR 1064 (42000) at line 26: 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 'TYPE=InnoDB' at line 22
where it complains about TYPE=InnoDB statement, which should be ENGINGE=InnoDB. Even with the --compatible option it still keeps the STATS_PERSISTENT statement.
Is there a way to port a mysql 5.7 database to mysql 5.5?
UPDATE
To be clear on my question, I am looking for relialble, i.e. no-hack way, to port the database. I already tried to replace TYPE with ENGINE, remove STATS_PERSISTENT etc. Something else always came up. I am not willing to jump through those hoops everytime I port the database. I am looking for a reliable way via mysqldump or a similiar tool to do the job.
If this is not possible then I will have to switch to an alternative DB.

Setting up timezones in mysql

I'm a MySQL/WAMP newbie attempting to set up timezones so that I could follow along with a course on the topic, but then I started having troubles when the instructions I was being given didn't correspond to the info on the MySQL page from which I was to download the setup file, http://dev.mysql.com/doc/refman/5.7/en/mysql-tzinfo-to-sql.html.
Can anyone tell me why, when I attempt to run this command from the mysql command prompt:
mysql -u root mysql < C:/timezone_posix.sql;
I get this error:
ERROR 1064 (42000): 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 'mysql
BTW, I've tried that with both forward and backward slashes, with and without quotes, etc., from my WAMP 5.6.17, MySQL command prompt, and the file in question is the posix (not isam) version that corresponds to the MySQL version on a windows machine.
You should be running that from the regular command prompt, not inside the mysql program, since it runs the mysql program. So it should be at the C:\ prompt.
Or you could use the mysql source command to read from a file:
mysql> use mysql
mysql> source 'C:/timezone_posix.sql'

Moving from mysql 3.3 to mysql 5.5

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?
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.