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;
異常信息
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
尷尬的提示
有時候,當你執行了上面的操作, 還是提示上述異常時,不要慌,有可能是你輸錯了用戶名或者密碼,不代表上面沒有生效。