0

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

while resetting the root password on mysql in root in Linux I am Facing Following Error?

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

how to Fix?

muhammad ahmad
asked May 9, 2019
1 Answer
0

First You need to Find a path of socket inside the /etc/my.cnf file.

For ex: /var/lib/mysql/mysql.sock

Just remove the file if it already exist /var/lib/mysql/mysql.sock

Now newly Create a file named as mysql.sock in /var/lib/mysql/

set the ownership and permission as shown below

chown mysql.root mysql.sock
chmod 775 mysql.sock

Restart the service use the command as follow service mysqld start
Then you can set or reset the password of root user in mysql

mysql_secure_installation

Just press enter while asking the default root password of mysql
Then you can proceed with set the new password and user privileges to accessing the mysql

View More
linuxhelp
answered May 9, 2019
Your Answer
||||
x
 
100:0

Related News in ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'

Related News in ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock'