Reinstall MySql AND keep existing database tables and data
Please help!
There are server issues and MySql is no longer running on our server (Ubuntu). The service is not recognized and needs to be reinstalled. Unfortunately, the database has not been backed up for 48 hours and that is a lot of information.
How do I reinstall MySql AND keep all my database data? Please note - I can't access mysql at all. I can't use command line mysql nor phpmyadmin.
Thanks in advance and let me know if I am missing important details.
Solution 1:
MySQL database files are stored in /var/lib/mysql. This folder stays untouched when you remove or re-install the MySQL package, but only if you use apt-get remove
. Don't use apt-get purge
, which will remove the files in /var/lib/mysql.
You should also make a database backup. A copy of /var/lib/mysql may not be enough.