UBUNTU SOLUTION
If you are using AWS (Amazon Hosting), I could probably facing a cloud problem. I had a Zpanel Server installed on the "free tier" plan, and my MySQL became very unstable.
Sometimes the best solution could be install all over again. (usually I try to make a snapshop, as soon as I have the server up and running)
Well, the other solution, could be only reinstall the MySQL.
Usually this problem appear when you try to change something in the /etc/mysql/my.cnf
.
To fix it (works most of time), you will need to follow some steps (these step will try to normalize the MySQL instance)
First, try to reboot the server (if it doesn't work, follow to the next steps):
Other steps:
- First, create a backup from you MySQL folder
var/lib/mysql/
, just to make sure your data will be safe:
sudo -i
cp -R /var/lib/mysql/ ~/mysql
After that, remove/purge MySQL (this will remove: php5-mysql
, phpmyadmin
and other libraries, so after the procedure, you will have to reinstall again.
sudo apt-get purge mysql-server-5.1 mysql-common
Remove the folder /etc/mysql/
and its content:
Later on, check if the database files are still in the folder /var/lib/mysql/
and if they are not, then copy it back:
Okay, then install o mysql server again
apt-get install mysql-server
And finally install phpmyadmin and php5-mysql:
At last, restart the services and check if the status are okay now:
That's it! It should work. I hope it works for you! (don't worry about the old data.That's why we have backup it first)
sudo status/restart/start mysql
is the way to invoke upstart jobs OR You can dosudo service mysql start/restart/status
.