I\'m getting this error
ERROR 2002 (HY000): Can\'t connect to local MySQL server through socket \'/var/run/mysqld/mysql.sock\' (2)
even though
On Debian this was a bind problem for me so changing bind-address
from localhost
to 0.0.0.0 helped.
vim /etc/mysql/my.cnf
bind-address = 0.0.0.0
I deleted everything connected to mysql with
sudo apt-get remove --purge --auto-remove mysql-client-5.7 mysql-client-core-5.7 mysql-common mysql-server-5.7
sudo rm -r /etc/mysql* /var/lib/mysql* /var/log/mysql*
and then reinstalled it again with
sudo apt-get update
sudo apt-get install mysql-server
and then started it with
mysql -u root -p
followed by the password
In my case the problem was that I had added "default-character-set=utf8" to my.cnf and that was corrupting the file. Instead change that line for "character_set_server=utf8". That should solve it, hope this helps.
I have follow Wellington Lorindo posting. And My problem was solved.
Steps 1. run in terminal
ps ax | grep mysql
Result was
11200 ? Ssl 0:01 /usr/sbin/mysqld
11514 pts/0 S+ 0:00 grep mysql
Steps 2. Again type this
sudo service mysql start
And problem solved.
Thanks Wellington Lorindo
Once you install or update MySQL, it won't ask you to create the root password. In that case: you will have file called "debian.cnf" path: /etc/mysql. You will find user name and password, login with that credentials and create new user and password.
I had the same problem when i installed xampp on my system. The mysql server looks for /var/run/mysqld/mysqld.sock but the mysql.sock file was in xampp folder so i used
find / -name '*.sock'
to find the mysql.sock file and then used
ln -s <the file location> /var/run/mysqld/mysqld.sock
to get a link for the *.sock file then tried mysql and it ran without error. Hope this could solve yours.
Remember to create the directory if it does not exists.