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

前端 未结 30 1062
离开以前
离开以前 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:22

    I just experienced the same issue after I had to restart my production server. I am running Debian 8.1 (Jessie) on a DigitalOcean droplet.

    This is what I did to resolve my issue:

    1. Check if the file /var/run/mysqld/mysqld.sock exists. If it doesn't, manually create it by entering touch /var/run/mysqld/mysqld.sock (which is what I had to do).

    2. So the MySQL process can use this file. Change ownership of said file by entering chown mysql /var/run/mysqld/mysqld.sock.

    3. Once '2' has been done, restart the MySQL service by entering service mysql restart or /etc/init.d/mysql restart.

    After going through the above steps, my issue was solved. I rarely have this issue, and there is probably a better way, so by all means provide constructive feedback if need be :).

提交回复
热议问题