Recover SQL database with directories only

Somehow my DO backups of my working were all corrupt – I had to revert from a backup and none of them would complete. Not looking for reason why now.

Using DO’s tools, I was able to boot a generic instance with the backup as a drive. I was able to go to the MySQL folder and download all the directories of all my databases. But, I can find no way to get them, or one of them, into a new instances database, which requires a .sql file to import.

Any bright ideas to get these directories into the form that I can import them please? Thank you.

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there,

I’ve faced that MySQL problem in the past with another provider. What I did to fix the problem was:

  • Created a fresh new server and installed the exact same MySQL version as the old one

  • Then stopped MySQL on that new server:

systemctl stop mysql
  • Again on the new server rename the /var/lib/mysql to /var/lib/mysql-backup:
mv /var/lib/mysql /var/lib/mysql-backup
  • Then copy the mysql folder from your backup to the freshly created server and add it to the /var/lib/mysql directory.

  • After that set the owner of the files and folders to the mysql user:

chown -R mysql:mysql /var/lib/mysql
  • Finally start MySQL and repair the tables if needed

Let me know how it goes. Regards, Bobby