I have transfer the mysql data dir from one linux box to another box. When i start the mysql server. I can find that the innodb based DB are corrupted. So, may i know how to recover the corrupted innodb
There are basically two ways to move mysql data from one DB server to another
OPTION 1 : Use mysqldump
Next, scp the /root/MySQLData.sql.gz over to /root of the new DB server
Then, on the other DB, delete everything in /var/lib/mysql except /var/lib/mysql/mysql. In other words, make sure when you do
Finally, load the data in the new DB Server
OPTION #2 : Copy /var/lib/mysql folder over to /var/lib/mysql on the new machine
This entails copying the physical representation of the data. You can tar gzip that folder and copy it as you have already done. If mysql cannot startup on the target server, check the COMMON NEEDS first, then run
COMMON NEEDS OF BOTH OPTIONS
Make sure of the following:
If the DB on the source DB server has only .frm files, ib_logfile0, ib_logfile1, and ibdata1, chances are you have innodb_file_per_table disabled. It is very important that you have the exact same innodb setting in /etc/my.cnf on the target DB server as you had on the source.
Hope these help !!!