Our MySQL on Ubuntu 15.04 stopped working after we moved the computer to a new location and kept giving the missing socket file error. We couldn't really fix it after trying sudo apt-get install -f
and there was an error about mysql-server-5.6 being corrupted.
So after a lot of trail and error I was able to remove mysql-server-5.6 following commands here : https://askubuntu.com/questions/172514/how-do-i-uninstall-mysqli
sudo apt-get remove --purge mysql-server mysql-client mysql-common
sudo apt-get autoremove
sudo apt-get autoclean
sudo rm -rf /var/lib/mysql
sudo rm -rf /etc/mysql
Afterwards, I reinstalled mysql server by:
sudo apt-get install mysql-client mysql-server
Then when I tried mysql -u root -p
and inside mysql, I couldn't see any previous databases..
I now realized that I've removed the /etc/mysql/my.cnf file from the system and my understanding is that mysql doesn't know where the databases files are and they haven't been loaded into the databases yet.
I should also mention that, the /etc/mysql/my.cnf file is basically empty with these two lines:
!includedir /etc/mysql/conf.d/
!includedir /etc/mysql/mysql.conf.d/
I have .sql files for each database from a previous logical backup in February. The issue is that I don't know if there were any updates between the February backup and now (as I'm new to manage this database). I also have the path to a directory (let's call it a B directory) that contains what I believe the database files as many directories names match the database names. And in this B directory, many directories seem to be modified after February so it's very likely there were updates.
I'm reading other questions and the B directory contains the following files among others:
ibdata1
ib_logfile0
ib_logfile1
tokudb.directory
tokudb.environment
a bunch of *.tokudb
I understand I could use the following command to restore the February backup.
mysql -u username -p database_name < file.sql
But I'm wondering if there is any possibility to bring those updated database files back to life to MySQL. If so, how to do this? I'm guessing I need to somehow restore the previous /etc/mysql/my.cnf file.. but not sure what are required lines to put from this list I found: http://www.fromdual.com/mysql-configuration-file-sample
I'm not very familiar with MySQL backup and I'm still reading about mysqldump and what it does. I'm wondering if I can use the February .sql files and somehow apply it to the latest mysql database files??? Hopefully this and the title are clear..
Thanks so much for the help!