Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to move database from MySQL server version 5.0.77 to 5.0.85 by copy database files between the servers
(shut down mysqld and copy the .frm, .myd, and .myi files from one database folder to another)

Many people tell me that I need to have same MySQL server version.
But I dont know how to upgrade MySQL server to specific version.

Thanks in advance.

share|improve this question

migrated from Dec 25 '09 at 16:21

This question came from our site for professional and enthusiast programmers.

You'll probably get more traction with this question over on - stackoverflow is more programming related. – middaparka Dec 25 '09 at 10:54
thanks for suggestion – Komputer Dec 25 '09 at 12:19
possible duplicate of How to upgrade MySQL server 5.0.77 to 5.0.85 on CentOS 5.3? – Chris S Nov 18 '11 at 22:54

That is basically what you can do shutdown mysql on the source server and destination server, tar up the mysql data directory, rename the data directory on the destination server, then copy the tarball, extra and then start up the server.

However, this assumes that you are upgrading to a minor version (like what you are doing). If you upgrading to a major version (i.e. from 4 to 5 or 5.5), it is likely a different story.

share|improve this answer
very nice, thanks. Just copy and paste mysql data directory – Komputer Dec 25 '09 at 14:03
Yes, but be sure to check the differences between the two. Sometimes there is a minor change that could impact your existing tables. Just in case, do a database dump prior to the upgrade. If the first option does not work, you can try importing with a dump file, adjusting the insert statements as necessary. One more thing - be sure that the destination server have the same database engines as the source. You can check by type in the console: show engines If there is a missing engine, you may have to add that in or make sure that the the existing databases don't use the missing engines. – Rilindo Dec 25 '09 at 22:34
To emphasize, the SAFEST way is to use mysqldump to throw all of the bits into one file, then on the new server import it with a basic mysql command. However, you can copy the data dir (and /etc/my.cnf!) to the new machine for these specific versions mentioned. – troyengel Jan 29 '10 at 0:03

By copying those files you'll only move MyISAM tables but not InnoDB ones. Better way is to use mysqldump.

mysqldump -u user -ppassword database_name > /path/to/backup_file.sql

and then to import on new database

mysql -u user -ppassword database_name < /path/to/backup_file.sql

This method is version independent and you don't have to worry about loosing any data.

As for upgrade it depends how did you install your current MySQL. You could try running the following command:

yum update mysql

or if you compiled it from source then you have to download a new version and recompile it.

share|improve this answer

The safest way is a dump and load. i.e. Dump the databases from the source machine to sql/text files and then import them at the destination.

share|improve this answer

take back of data base and you run yum upgrade mysql*

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.