0

ERROR 2002 (HY000): Can't connect to local MySQL server

I installed LAMP on Ubuntu and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to change password through terminal I get this error.
How can I fix this? I am unable to open LAMP, uninstall it, or reinstall it.

LAMP Ubuntu Add a comment
mason
asked Dec 10 2020

Answer

0

Make sure that you have installed the mysql-server, not the mysql-client or something else.
error means the file /var/run/mysqld/mysqld.sock doesn't exists
Hence
Install it using following command
sudo apt-get install mysql-server

But if the mysql-server is already installed and is running, then you need to check the config files.
The config files are:

The config files are:

/etc/my.cnf
/etc/mysql/my.cnf
/var/lib/mysql/my.cnf

Let the mysql use the /etc/my.cnf by renaming the /etc/mysql/my.cnf.
Then prob may solve.

Add a comment
linuxhelp
asked Dec 10 2020
Post your Answer
0

Perhaps the best MySQL tool, with a GUI and IDE, can help you in this situation. You can use mysql gui for linux https://www.devart.com/dbforge/mysql/studio/ by dbForge Studio and it will help you with many tasks. And you can also optimize your daily workflow, and automate the management of database objects, and much more.

Add a comment
sheenaowens
asked Feb 23 2023
edited Aug 25 2023
Post your Answer