RE: Migrate databases after mysql has died
05-23-2015, 12:11 AM
(This post was last modified: 05-23-2015, 08:24 PM by baychae.)
(05-22-2015, 07:25 PM)apinto Wrote: Please provide more details about your MySQL config.
Usually MySQL does not die, you should have some error that can be fixed.
Keep in mind:
- If the table is using the MyISAM (default) engine you can probably move the files. You can't move the files if it's using InnoDB.
- This is never the better alternative. You should fix the MySQL error first.
This might be usefull: https://www.linode.com/docs/databases/my...-databases
Hope this somehow has helped you
I'm sorry to say that it didn't. My most immediate problem was to migrate the apparently broken database to a new server and get it hooked up to Sentora.
Its true to say I hadn't explained that InnoDB was corrupt and could not be fixed but I feel that topic would be best discussed in a separate thread. This thread is about migrating a database when mysql has died and cannot be revived. Say for example when your site has died and you need to get it back up and running quickly.
Mysql must have used both Innodb and MyiSAM I can only deduce from what you have written. Mysql would start then crash as Innodb had been corrupted. Though the tables existed in file in /var/lib/mysql/<my_database>.
This is how I performed the migration with no mysqldump available on the broken server.
- Broken server - Navigated to /var/lib/mysql
- Broken server - Compressed the database folder.
- Broken server - Moved compressed file to new clean sentora server.
- New server - Uncompressed the file into the new servers /var/lib/mysql/<my database> folder
- New server - Used mysqldump to dump <my database> to a my_database.sql file
- New server - using mysql dropped <my database> that had been manually installed.
- New server - In sentora panel created a new database.
- New server - In mysql command line import <my database> : mysql -u root -p zadmin_<my database> < my_database.sql
This worked for me. I wish I had done this first instead of wasting time trying to restore a completely corrupt InnoDb database.