Linux – Get thesql database from raw files

innodblinuxMySQL

My root access linux server has crashed and I cannot SSH into it or interact with it. I can, however tell the online console to do a network boot to a "rescue system" which allows me to access the files on the server.

This means I can only get the raw folder of my database and I can't perform an SQL dump.

It doesn't work if I just copy the folder of my database, because on my new working server it says some tables are not available. Apparently it is because of InnoDB and that I should copy the ibdata1, ib_logfile0 and ib_logifle1 files as well.

Can I just overwrite the ib* files on my news server with the ib* files of the old server? Is there any way I can transfer this database just by copying files?

Best Answer

If you copy the ib* files and all the subdirectories in /var/lib/mysql (or whatever you MySQL data directory was) along with the my.cnf from /etc to the new server, it should start up as if nothing had happened. There is no way to transfer InnoDB tables or databases other than that. Even with the innodb_file_per_table option, InnoDB still stores metadata in the central database file, so you cannot recover without it.

Related Topic