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

后端 未结 17 1750
执笔经年
执笔经年 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:55

    There is a good and regularly updated guide on how to set a new password for the latest MySQL.

    https://www.digitalocean.com/community/tutorials/how-to-install-mysql-on-ubuntu-20-04

    It would be best to read whole topic from the link above but in short, this maybe could help,

    Run the security script:

    sudo mysql_secure_installation
    

    Detailed Info for "mysql_secure_installation"

    After that, you can change password by following the next steps

    sudo mysql
    

    mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH caching_sha2_password BY 'password';

    Detailed Info for changin root user password

    If you have a problem maybe you will need to reinstall MySql.

提交回复
热议问题