Migrate database after mysql has died
#1
Migrate database after mysql has died
I need to quickly migrate /var/lib/mysql databases as mysql has died and will not restart so no mysqldump.

Can anyone give guidance on how I can integrate databases copied to /var/lib/mysql into sentora?
Reply
#2
RE: Migrate databases after mysql has died
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 Wink
My Sentora Resources
[Module] Mail Quota Count | Vagrant Box with Sentora

[Image: vanguardly-logo-micro.png]
Graphic and Web Design. Development.
www.vanguardly.com


Reply
#3
RE: Migrate databases after mysql has died
(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 Wink

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.
Reply
#4
RE: Migrate database after mysql has died
Think now about setting a DB backup hourly or daily.

That would help you.
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply
#5
RE: Migrate database after mysql has died
(05-23-2015, 04:15 AM)Me.B Wrote: Think now about setting a DB backup hourly or daily.

That would help you.

As you mention it my probably wrong assumption was that sentora took daily backups by default.

How do I set that up?
Reply
#6
RE: Migrate database after mysql has died
(05-23-2015, 06:39 PM)baychae Wrote:
(05-23-2015, 04:15 AM)Me.B Wrote: Think now about setting a DB backup hourly or daily.

That would help you.

As you mention it my probably wrong assumption was that sentora took daily backups by default.

How do I set that up?

Ah. Here we are.

Sentora(HomePage) -> Admin -> Module Admin -> Backup Config. 

Daily backups is by default set to false. Daily backups has been set from false to true.
Reply
#7
RE: Migrate database after mysql has died
That would set FULL customers daily backup.

For MySQL as the informations might change a lot within 24h. So I usually set a different backup plan for such key information. You need a cron for that.

M B
No support using PM (Auto adding to IGNORE list!), use the forum. 
How to ask

200$ free to start your VPS 60 days credit
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
MySQL Database user prefix MosleyCale 1 6 ,676 10-17-2020, 09:11 PM
Last Post: Ron-e
Senator crash problem with mysql provokas 3 12 ,286 08-20-2020, 04:11 AM
Last Post: Your Creator
Critical Error: [0100] - Unable to connect or authenticate to the Sentora database whatshisface77 1 5 ,458 07-31-2020, 10:58 AM
Last Post: whatshisface77

Forum Jump:


Users browsing this thread: 3 Guest(s)