How to recover mysql folder?

Mysql Not Working. Site Crashed- (Emergency) After following other steps mentioned in some of the similar Digital Ocean posts, i discovered that my MYSQL folder is not present or that i cannot find it. I want to know how to find it or how to recover the folder to acces my existing DB. It had alot of data.

Associated Droplet: ubuntu-512mb-blr1-01

oops connection problem ! --> Can’t connect to local MySQL server through socket ‘/var/run/mysqld/mysqld.sock’ (2)

That’s the error showing everywhere, be it from a terminal or from the browser. We have important information in our databases and we cannot afford to lose them. Please help asap. Our store website is down since the last 48 hours. Perhaps more.

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, I have a similar problem and I have followed the steps listed above and here is the print out from the error log

2019-04-10T13:46:51.372508Z 0 [Note] Shutting down plugin 'INNODB_FT_BEING_DELETED'
2019-04-10T13:46:51.372512Z 0 [Note] Shutting down plugin 'INNODB_FT_DELETED'
2019-04-10T13:46:51.372517Z 0 [Note] Shutting down plugin 'INNODB_FT_DEFAULT_STOPWORD'
2019-04-10T13:46:51.372521Z 0 [Note] Shutting down plugin 'INNODB_METRICS'
2019-04-10T13:46:51.372526Z 0 [Note] Shutting down plugin 'INNODB_TEMP_TABLE_INFO'
2019-04-10T13:46:51.372531Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_POOL_STATS'
2019-04-10T13:46:51.372535Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE_LRU'
2019-04-10T13:46:51.372539Z 0 [Note] Shutting down plugin 'INNODB_BUFFER_PAGE'
2019-04-10T13:46:51.372544Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX_RESET'
2019-04-10T13:46:51.372548Z 0 [Note] Shutting down plugin 'INNODB_CMP_PER_INDEX'
2019-04-10T13:46:51.372552Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM_RESET'
2019-04-10T13:46:51.372557Z 0 [Note] Shutting down plugin 'INNODB_CMPMEM'
2019-04-10T13:46:51.372561Z 0 [Note] Shutting down plugin 'INNODB_CMP_RESET'
2019-04-10T13:46:51.372565Z 0 [Note] Shutting down plugin 'INNODB_CMP'
2019-04-10T13:46:51.372570Z 0 [Note] Shutting down plugin 'INNODB_LOCK_WAITS'
2019-04-10T13:46:51.372573Z 0 [Note] Shutting down plugin 'INNODB_LOCKS'
2019-04-10T13:46:51.372578Z 0 [Note] Shutting down plugin 'INNODB_TRX'
2019-04-10T13:46:51.372582Z 0 [Note] Shutting down plugin 'InnoDB'
2019-04-10T13:46:51.372634Z 0 [Note] InnoDB: FTS optimize thread exiting.
2019-04-10T13:46:51.372757Z 0 [Note] InnoDB: Starting shutdown...
2019-04-10T13:46:51.473037Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
2019-04-10T13:46:51.473708Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 190410 13:46:51
2019-04-10T13:46:52.482276Z 0 [Note] InnoDB: Shutdown completed; log sequence number 4825347390
2019-04-10T13:46:52.484340Z 0 [Note] InnoDB: Removed temporary tablespace data file: "ibtmp1"
2019-04-10T13:46:52.484367Z 0 [Note] Shutting down plugin 'MEMORY'
2019-04-10T13:46:52.484376Z 0 [Note] Shutting down plugin 'sha256_password'
2019-04-10T13:46:52.484381Z 0 [Note] Shutting down plugin 'mysql_native_password'
2019-04-10T13:46:52.484541Z 0 [Note] Shutting down plugin 'binlog'
2019-04-10T13:46:52.484917Z 0 [Note] /usr/sbin/mysqld: Shutdown complete


Have you made any modifications to MySQL’s configuration? Generally that specific error is caused by changes to the configuration, which are not valid, unless your MySQL directories were in fact removed somehow.

On Ubuntu, your MySQL data directory should be located at /var/lib/mysql. As long as that directory exists, then you should still have your data. If that directory has been removed, without backups, there’s no way to restore it.

Quick Tip: Make sure you’re regularly backing up your data/databases. If you don’t have valid, working backups, there’s no way to restore your data.

That said, what you can do is backup that directory – do this first.

mkdir -p /usr/local/src/mysql
cp -R /var/lib/mysql/* /usr/local/src/mysql

The above creates a backup directory and then copies all files in the MySQL data directory to it, so if something should happen with what we do next, we have a backup copy of your data.

Now, we need to see what errors MySQL is throwing when you try to start MySQL, so go ahead and run:

service mysql restart

Then run this command to grab the last 30 lines from the error log:

tail -30 /var/log/mysql/error.log

Paste that output to a code block as a reply so it’s formatted and we can see what’s going on. I’d do this before we attempt to remove MySQL and then reinstall.