error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)' — Missing /var/run/mysqld/mysqld.sock

后端 未结 30 2150
日久生厌
日久生厌 2020-11-22 10:49

My problem started off with me not being able to log in as root any more on my mysql install. I was attempting to run mysql without passwords turned on... but whenever I

30条回答
  •  粉色の甜心
    2020-11-22 11:47

    Try the following at a terminal prompt:

    sudo mysql
    

    Once that lets you in, you can create a new user and grant privileges that you want on the specific database they need access to.

    Mysql 5.7 changed some things and by default uses the auth_socket plugin (as opposed to mysql_native_password) for root to protect the account from getting hacked. You can override this by setting the plugin field for root, but unless you have a very good reason you probably shouldn't circumvent the protection. Especially when sudo mysql is easier than mysql -u root -p anyway.

    I found out this info - of all places - from a Raspberry Pi help site. Worked like a charm after Lubuntu 18.04 annoyed the heck out of me for a couple hours.

提交回复
热议问题