mysql 8 修改密码

mysql 8 修改密码

mysql8之前用的是mysql_native_password,最新的认证方法是caching_sha2_password,有时候需要使用mysql_native_password。

1 操作步骤

1.1 创建用户

create user 'chuan'@'%' identified by '123456';

1.2 用户授权

grant all privileges on *.* to 'chuan'@'%'

1.3 更改密码加密的方法

alter user 'chuan'@'%' identified with mysql_native_password by '123456';

1.4 刷新权限

flush privileges;

异常信息

image.png

MySql.Data.MySqlClient.MySqlException (0x80004005): Authentication method 'caching_sha2_password' failed. Either use a secure connection, specify the server's RSA public key with ServerRSAPublicKeyFile, or set AllowPublicKeyRetrieval=True

尴尬的提示

有时候,当你执行了上面的操作, 还是提示上述异常时,不要慌,有可能是你输错了用户名或者密码,不代表上面没有生效。

你可能感兴趣的:(mysql 8 修改密码)