How to solve Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’
Hi Friends today I got an error when using mysql I was not able to login as a root user . Actually I have used mysql long before and now when I try to relogin it showed me some error like this ” Can’t connect to local MySQL server through socket ‘/var/lib/mysql/mysql.sock’ ” . I dont know the exact reason for why it had happened . But I was able to solve through web research on this query . The steps I had followed are :-
(1) To check the my.cnf file is correctly configured I used this command : –
(2) To check if the mysql runs with the commands we can use this : -
mysqladmin -u root -p status
(3) If this had worked then u have to change the access to your mysql folder . And this can done by following this command :-
sudo chmod -R 777/var/lib/mysql/
By FOLLOWING THIS STEP I WAS ABLE TO SOLVE MY PROBLEM .