mysql8.0报错问题,数据库连接不上,报The server requested authentication method unknown to the client

其实很简单的,首先说明一下为什么会报错,一是密码太简单了,其二是没有配在[mysqld]中添加下边的代码
default_authentication_plugin=mysql_native_password;下面说一下怎么做;
一在mysql8.0报错问题,数据库连接不上,报The server requested authentication method unknown to the client
用记事本编辑,里面写
mysql8.0报错问题,数据库连接不上,报The server requested authentication method unknown to the client
[mysqld]

设置默认字符集,只会影响新建数据库的默认字符集

character-set-server=utf8
default_authentication_plugin= mysql_native_password
接着在mysql里面编辑修改密码,密码一定要加字母就是为了安全性,是的就是这样,怎么修改密码写一下步骤;
一使用win+r输入cmd,
二、在里面输入
mysql -uroot -p123456”,root是mysql用户名,123456是密码,可以看到可以直接打开,
然后输入
登录MySQL后输入:

ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘YourPassword’;

FLUSH PRIVILEGES;
真就做到这里就会成功的;
相信自己,我也是这么一步步来的,错误不可怕,我们做出来就会很有成就感的