ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
snippet in sql

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

user4939

# Remove mysql
sudo apt-get remove --purge mysql\*

#update repositories
sudo apt update

# Reinstall it
sudo apt install mysql-server mysql-client

# Test if it runs
sudo mysql

# You can install also thes pachages. Optionnaly
sudo apt install php

#mesabo youbeyou

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.s

user9547

> ln -s /var/lib/mysql/mysql.sock /tmp/mysql.sock
> 
> service mysql start or service mysql start

can't connect to local mysql server through socket '/var/run/mysqld/mysqld.sock'

user4672

# this saved my ass
# first  you must perform a graceful shutdown of the server from the command line rather than powering off the server
shutdown -h now

# an additional method for getting it back up again when you run into this problem is to move mysql.sock

# to centos
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak

# to ubuntu
mv /var/run/mysqld/mysqld.sock /var/run/mysqld/mysqld.sock.bak

# restart mysql
service mysqld start

ERROR 2002 (HY000): Can

user8660

# This is usually caused by the fact that the
# MySQL Server isn't even running
# On Windows, check your services, if its not running
# start it, or install and start it.

# On *nix, for this example Debian based
# Firstly see if it's even running
ps aux | grep mysql

# If you dont see any process other than your grep call,
# It's not running

# Assuming you have mysql-server installed
# Start it
sudo /etc/init.d/mysql start

# Otherwise install it, configure and start it up as above
sudo apt-get install mysql-server

# Goodbye 2002

ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)

user1730

sudo apt-get install mysql-server

error 2002 (hy000): can't connect to local mysql server through socket '/var/run/mysqld/mysqld.sock' (2)

user3447

mysql -h 127.0.0.1 -P 3306 -u root -p <database>