1

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
Mokus
  • 412
  • 1
  • 11
  • 19

2 Answers2

2

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

RolandoMySQLDBA
  • 16,364
  • 3
  • 47
  • 80
1

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.

Mircea Vutcovici
  • 16,706
  • 4
  • 52
  • 80