当前位置:   article > 正文

mysql设置身份验证设置_MySQL 8.0 配置mysql_native_password身份验证插件的密码

default authentication plugin=mysgl native password

MySQL 8.0 配置mysql_native_password身份验证插件的密码

mysql8.0的默认密码验证不再是password。所以在创建用户时,create user ‘username‘@‘%‘ identified by ‘password‘; 客户端是无法连接服务的。

方法一:

登录MySQL后输入:

ALTER USER ‘username‘@‘localhost‘ IDENTIFIED WITH mysql_native_password BY ‘password‘;

FLUSH PRIVILEGES;

方法二:

编辑my.cnf文件,更改默认的身份认证插件。比如说:

vim /data/mysql/mysql_3306/my_3306.cnf

# 在[mysqld]中添加下边的代码

default_authentication_plugin=mysql_native_password

这个需要重启服务才生效。

mysql> select user,host,plugin from mysql.user;+------------------+-----------+-----------------------+

| user | host | plugin |

+------------------+-----------+-----------------------+

| bak | % | mysql_native_password |

| monitor | % | mysql_native_password |

| repuser | % | caching_sha2_password |

| mysql.infoschema | localhost | caching_sha2_password |

| mysql.session | localhost | caching_sha2_password |

| mysql.sys | localhost | caching_sha2_password |

| repuser | localhost | caching_sha2_password |

| root | localhost | caching_sha2_password |

+------------------+-----------+-----------------------+

8 rows in set (0.00 sec)

原文:https://www.cnblogs.com/bjx2020/p/12118614.html

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小蓝xlanll/article/detail/594374
推荐阅读
相关标签
  

闽ICP备14008679号