Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have two old mysql servers and now I bought a new server and I want to migrate the files to this server, my question is if I copy all those files to the new server will the mysql recognize this files, or do I have to change some options. Both servers are MyISAM and the new server as well.

UPDATED: Ex:

server one:    
    table1
    table2
    table3

server two:
    table4
    table5
    table6

new server:
    table1
    table2
    table3
    table4
    table5
    table6
share|improve this question
    
Are there any databases with the same name on both machines? Or users with the same name? –  Raffael Luthiger Jun 7 '11 at 19:25
    
Only just the root with the same password. there is one database named ex: 'test' but the table's names are different. –  run Jun 7 '11 at 19:37
    
Updated My Answer !!! –  RolandoMySQLDBA Jun 7 '11 at 20:05

2 Answers 2

up vote 2 down vote accepted

If all tables are MyISAM I have good news !!!

A mysqldump, while it will work and is bitwise safer and conservative, is totally not required.

Each MyISAM table is comprised of three files: .frm, .MYD, .MYI.

You should be able to simply move the tables into a new database folder.

The information_schema database will automatically detect the presence of the three files and update itself (specifically update information_schema.schemata). Here is proof that can happen:

While MySQL is still running do the following

cd /var/lib/mysql
mkdir thisisatest
mysql

Once you run SHOW DATABASES; you should see thisisatest appear as a database. That's because information_schema automatically updated itself and registered /var/lib/mysql/thisisatest as a database. MyISAM tables will regsiter itself the same way (specifically update information_schema.tables). WARNING : THIS IS NOT POSSIBLE WITH InnoDB !!!

share|improve this answer

Export the tables with mysqldump. Make sure to filter out the tables/databases that you do not need to import or overwrite. Import with something like mysql < import.sql.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.