I am having a big problem trying to connect to mysql. When I run:
/usr/local/mysql/bin/mysql start
I have the following error :
<
I was getting the error because I was running MAMP and my .sock file was in a different location. I just added a symbolic link where the app thought it should be that pointed to where it actually was and it worked like a charm.
If your file my.cnf (usually in the /etc/mysql/ folder) is correctly configured with
socket=/var/lib/mysql/mysql.sock
you can check if mysql is running with the following command:
mysqladmin -u root -p status
try changing your permission to mysql folder. If you are working locally, you can try:
sudo chmod -R 755 /var/lib/mysql/
that solved it for me
I had the same problem and it has been caused by an update of mysql drivers when mysql server was running. I fixed it just restarting both mysql and apache2:
sudo service mysql stop
sudo service mysql start
sudo service apache2 stop
sudo service apache2 start
sudo service mysqld start
Worked for me, I'm using Centos
This was good enough for me
sudo /etc/init.d/mysql restart
If everything worked just fine and you just started seeing this error, before you do anything else, make sure you're not out of disk space:
df -h
If the volume where the mysql.sock is being created is at 100% use, MySql won't be able to create it and this will be the cause of this error. All you need to do is delete something that's not needed, like old log files.