Restoring a MySQL database My Ubuntu 16.04 server was recently hacked and my host allowed me to recover the file system via FTP, closing all other ports thus disabling me from logging in and stopping any services. I have the files on a local windows filesystem, which were copied while the server and services were still running.
I have a new Ubuntu 18.04 server, where I have installed MySQL but not WordPress (which is powered by MySQL); most of all, I want my WordPress blog back up on my new server, then I can write a post about the importance of CORRECTLY backing up a database. Can anyone tell me if this is possible and what I should do next?
It is not safe or reliable to ftp the files in your MySQL datadir while the MySQL server is running. MySQL keeps part of the data and metadata in memory, and writes them to the files on disk asynchronously. If you try to copy the files, this takes a non-zero amount of time, so you are likely to copy the files while they're being updated by MySQL Server. So you get the early part of the file before the update, and the latter part of the file after the update. The result is potentially an irreconcilable corrupt file.
A simple Wordpress blog is likely to have low traffic, so it's not like it's in a constant state of update. But the risk is still there.
You should work with your hosting provider to give you temporary ssh access. Or ask them to stop MySQL Server on your behalf.
And yes, make backups of your MySQL database regularly. I use jetpack.com to run automatic backups for me.