开发者

MySQL 5.0.22 export dump file not importing - syntax errors

开发者 https://www.devze.com 2022-12-31 01:59 出处:网络
I backed up my db with mysqldump from phpMyAdmin.Using MySQL 5.0.22.Made no changes to da开发者_开发百科tabase file.Import fails.Found many instances of extra spaces using notepad, but now cannot find

I backed up my db with mysqldump from phpMyAdmin. Using MySQL 5.0.22. Made no changes to da开发者_开发百科tabase file. Import fails. Found many instances of extra spaces using notepad, but now cannot find any other such extraneous spaces. Error is 1064.

Any suggestions on how to import file properly?

Thanks.


I encountered problems with mysql dumps of entire databases including views. So now I dump the tables and data as a separate dump, and export the views, stored routines and functions separately. I restore the tables first then the views etc.

Having come from MS SQL Server and Oracle I would like to know if there are any totally reliable tools out there for MySQL database backups and restores.


You have done several things wrong here

  1. Using PHPMyAdmin for anything critical, especially backups. It is not production-ready, in my experience. Feel free to use it for unimportant read-only work on noncritical servers however.
  2. Editing mysqldump files with notepad (or any other editor). Despite appearances, mysql dump files are not text files and should not be edited with any editor. They contain binary data which is not valid in most character encodings, and therefore can probably not be loaded/saved without introducing errors.

Make a fresh dump using mysqldump, which is the only reliable way of making them, and import that. Do not edit mysql dump files using notepad or any other text tool (this includes the likes of grep, sed etc).

If you need to edit a mysql dump file, then restore it into another (i.e. non-production) database instance, make the necessary changes using SQL commands and re-dump the database. This may be slow but it's reliable.

0

精彩评论

暂无评论...
验证码 换一张
取 消