"Check your log files as in the other answers. Also, check that you have enough (or any disk-space). MySQL can behave in this way on an empty partition.
df -h
If it's not that, check out MySQL's docs on debugging a server. Their myisamchk (if you're using MyISAM) is particularly useful."
Had this same problem, turns out the solution was staring me in the face. The drive was full. You get no logs because there is no where to write them.....
"The same problem plagued me for ages on an Ubuntu 12.04 Digital Ocean VPS with mysql 5.6 installed from a PPA. The symptoms were the that the mysql.sock file at /var/run/mysqld/mysql.sock would get removed but never recreated, so I was having to manually run the following commands every time mysql was updated or the server rebooted:
sudo touch /var/run/mysqld/mysql.sock sudo chown mysql /var/run/mysqld/mysql.sock
This was from Kyle C's answer (except with mysqld instead of mysql). In the end I downgraded to mysql 5.5 which comes when you would normally perform a sudo apt-get install mysql-server command. However it wasn't straight forward so here is what I had to do:
# Manually get mysql running if it is not sudo touch /var/run/mysqld/mysql.sock sudo chown mysql /var/run/mysqld/mysql.sock sudo service mysql start
# take a dump of all databases # we are going to remove the mysql files so don't skip this) mysqldump -u root -p > all-databases.sql
# Remove mysql 5.6 from debs (otherwise it will reinstall 5.6) rm /etc/apt/sources.list.d/ondrej-(mysql something please check)
# remove a flag that would prevent the installation # because it is seen as a downgrade sudo rm /var/lib/mysql/debian-5.6.flag
# I had to remove the mysql files as well # reference http://ubuntuforumsdotorg/showthread.php?t=1998260&page=3 rm -rf /var/lib/mysql rm -rf /etc/mysql*
# Install mysql sudo apt-get install mysql-server mysql-client mysql-common php5-mysql
# manually update the all-databases.sql file and # remove all STATS_PERSISTENT clauses on table creation statments
# re import the databses mysql -u root -p < all-databases.sql
# restart apache sudo service apache2 restart
# at this point my wordpress site stated error connecting to database. # This was resolved by logging into mysql and running: FLUSH PRIVILEGES
Hopefully this will help someone else having the same pain."