Error:ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol

MySQL 8.0.33After the installation is complete, an error is reported when using it:

Error:ER_NOT_SUPPORTED_AUTH_MODE: Client does not support authentication protocol

I found a solution on the Internet to solve the problem. In order to avoid the same problem next time, I will record the solution.

1. 启动数据库 net start mysql
2. 登录数据库 mysql -u root -p
3. 用数据库
   // eg:有 sys,name , age三个数据库,用哪个就需要执行哪个命令,如下:
   mysql> use sys
4. alter user 'root'@'localhost' identified with mysql_native_password by '123456';  // root@后面是user表的Host字段的内容,新安装默认是localhost;123456为数据库密码
5. flush privileges;  // 重新加载权限表    

As shown below:

insert image description here

There are different ways to assign new rootpasswords before and after. MySQL 8.0.4Before, MySQLthe password authentication plugin was “mysql_native_password”, and after, it was used “caching_sha2_password”. Therefore, MySQL8.0.4the method of modifying the password in the future uses: ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'newpassword'.

Guess you like

Origin blog.csdn.net/HH18700418030/article/details/130533381