Server is dead
Your server crashed but you have the MySQL data files from the old server or even better the complete backup of the old server?
Well, this is a simple one, if you only have the MySQL data files, put them in /var/lib/mysql on a different/new server, start MySQL and run mysqldump to dump the content to files which can be moved to a new server. This should be quite simple to install a similar server (VirtualBox, digital ocean, aws …) Ther might be some issues if the installed MySQL versions differ, I was about to go down this road when a much simple solution came to mind. If all the files from the crashed server are present and mounted, why not just chroot and start the old MySQL?
All you need to do now is:
- Chroot into the directory where you have your files from backup
- Start mysql
systemctl start mysql
- Run mysqldump
mysqldump -a --opt somedb > somedb.sql
- repeat 3. for all databases
- stop mysql
systemctl stop mysql
- Import the dumps to the new DB
mysql somedb < somedb.sql
But how did you even get into this mess? No MySQL backups?
You should at least install automysqlbackup, it might not be the fasted (compared to mydumper) but it get’s the job done.
When using debian it’s as simple as
apt-get install automysqlbackup or
apt-get install autopostgresqlbackup if you are running PostgreSQL.