I have run into a very common problem while setting up a lamp stack in ubuntu. The problem that I got into is, I try to log into phpmyadmin using 'root' as username and a password that I set during instillation, I don't know if the password is wrong or I forget or something else went wrong, any way I can't login. Now I search For the solution to reset the mysql password and I get the most suggested solution which is like below:
sudo /etc/init.d/mysql stop
sudo mysqld_safe --skip-grant-tables &
sudo mysql -u root
And during this third step I get the error like below:
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)
And Now I am stuck here, And I cannot reset password: So Help me
For me stopping and starting mysql did not help ('sudo /etc/init.d/mysql stop', 'sudo /etc/init.d/mysql start') Because I had to use the command to stop mysql: sudo /etc/init.d/mysql stop and then run other commands sudo mysqld_safe --skip-grant-tables & sudo mysql -u root before starting mysql: sudo /etc/init.d/mysql start
But simply restarting my system that is my laptop solved my problem.