(1698, “Access denied for user ‘root‘@‘localhost‘“)

(1698, "Access denied for user 'root'@'localhost'")

Mysql 报错问题处理:

Django 启动的时候报错:

(1698, “Access denied for user ‘root‘@‘localhost‘“)_第1张图片(1698, “Access denied for user ‘root‘@‘localhost‘“)_第2张图片

 

sudo mysql -u root 

进入到mysql 命令行

sue mysql
SELECT User, Host, plugin FROM mysql.user;

(1698, “Access denied for user ‘root‘@‘localhost‘“)_第3张图片

可以看到,root用户使用auth_socket 插件

可以将root用户设置为使用mysql_native_password插件

UPDATE user SET plugin='mysql_native_password' WHERE User='root';

FLUSH PRIVILEGES;

退出,重启mysql

service mysql restart

再次登录。查询,已经修改成功。

(1698, “Access denied for user ‘root‘@‘localhost‘“)_第4张图片

你可能感兴趣的:(Mysql,Ubuntu)