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

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

    I had a similar problem. mysql wouldn't start:

    sudo service mysql start
    start: Job failed to start
    

    If I disabled apparmor:

    sudo aa-complain /etc/apparmor.d/*
    

    the problem went away. The issue was that mysqld was trying to access /run/mysqld/mysqld.sock but the apparmor profile only gave permission to /var/run/mysqld/mysqld.sock (/var/run is symlinked to /run, so these are actually the same). Not sure why mysqld isn't using the var path since that's what's set in all the configuration files, but you can fix the problem by adding the following to /etc/apparmor.d/usr.sbin.mysqld

    /run/mysqld/mysqld.pid rw,
    /run/mysqld/mysqld.sock rw,
    

提交回复
热议问题