ERROR 1698 (28000): Access denied for user 'root'@'localhost'

后端 未结 17 1927
执笔经年
执笔经年 2020-11-22 10:00

I\'m setting up a new server and keep running into this problem.

When I try to login to the MySQL database with the root user, I get the error:

17条回答
  •  天命终不由人
    2020-11-22 10:57

    Check here:

    NEW Version of MYSQL does it this way.

    In the new my-sql if the password is left empty while installing then it is based on the auth_socket plugin.

    The correct way is to login to my-sql with sudo privilege.

    $ sudo mysql -u root -p
    

    And then updating the password using:

    $ ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'new-password';
    

    Once this is done stop and start the mysql server.

    $  sudo service mysql stop
    $  sudo service mysql start
    

    For complete details you can refer to this link.

    Do comment for any doubt.

提交回复
热议问题