MySQL DBA
MySQL DBA

Reputation: 5812

How to restore mysql database

I have taken the backup of mysql database but when I am trying to restore it my stored procedures are not getting restored. Is there any way like for backup we use --routines in mysqldump command. Can we do any such thing in mysql.

If I am using mysqldump then it is just dumping mysql tables but if I am using mysql command to restore then it is giving me an error - ERROR 1064 (42000) at line 3062: 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 'USING BTREE ) ENGINE=MyISAM DEFAULT CHARSET=latin1' at line 6.

Thanks in advance

Upvotes: 1

Views: 2879

Answers (2)

Philippe Paravicini
Philippe Paravicini

Reputation: 31

One solution is to dump the schema without the data, do a search replace for 'USING BTREE', create the db, and load a dump without the table definititions.

Or, on a un*x shell, and assuming you have perl available, this can be done directly using a full dump and filtering the file in place with perl (or awk, sed,ruby...) as such:

cat name-of-dump.sql | perl -pe 's/USING BTREE//' | mysql name_of_db

or if you dump is compressed:

zcat name-of-dump.sql.gz | ...

Upvotes: 3

Domas Mituzas
Domas Mituzas

Reputation: 239

you are restoring 5.1 backup to 5.0 instance. you will have to remove 'USING BTREE' from your table definitions, if you want to load this dump into 5.0.

Upvotes: 2

Related Questions