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

前端 未结 30 1140
离开以前
离开以前 2020-11-22 02:25

I installed LAMP on Ubuntu 12.04 LTS (Precise Pangolin) and then set root password on phpMyAdmin. I forgot the password and now I am unable to login. When I try to chan

30条回答
  •  逝去的感伤
    2020-11-22 03:05

    In my case it worked by doing some R&D:

    I am able to connect to MySQL using

    root-debian#mysql -h 127.0.0.1 -u root -p
    

    But it's not working with mysql -u root -p.

    I did not find any bind-address in my.cnf. So I outcommented the parameter socket=/var/lib/mysql/mysqld.sock in my.cnf which was causing me a problem with login.

    After restarting the service it went fine:

    root@debian:~# mysql -u root -p
    Enter password:
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 5
    Server version: 5.6.19 MySQL Community Server (GPL)
    

提交回复
热议问题