简体   繁体   中英

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

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

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM