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

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

    I was having this issue on an Debian 8 VM that I was interacting with through Putty on my Windows 10 desktop.

    I tried the various suggestions on here but nothing quite worked and I am running MariaDB on the Debian host. In the end I found that I couldn't start the db server in safe mode but I didn't need to and the following commands actually worked for me i.e. allowing a newly created MySql user to log into the MySql/MariaDB server:

    sudo service mysql restart
    sudo mysql # logs in automatically into MariaDB
    use mysql;
    update user set plugin='' where user='your_user_name';
    flush privileges;
    exit;
    sudo service mysql restart # restarts the mysql service
    

    If the above doesn't quite work for you, follow the steps outlined in zetacu's post above (zetacu) then follow my steps.

    Now you should be able to use a remote terminal client and securely log into mysql using the command:

    mysql -u your_user_name -p
    

    *type in the password when prompted

提交回复
热议问题