我用了你之前的方法改完之后,执行sudo mysql -u root -p -e 'select @@default_authentication_plugin;'发现还是caching_sha2_password不是mysql_native_password
时间: 2023-08-13 09:08:41 浏览: 50
好的,我明白了你的问题。如果你已经按照之前的方法修改了MySQL的配置文件并重启了MySQL服务,但是执行sudo mysql -u root -p -e 'select @@default_authentication_plugin;'仍然显示caching_sha2_password而不是mysql_native_password,那么可能是修改没有生效或者你修改了错误的配置文件。
你可以尝试检查一下你修改的是正确的配置文件,以及在修改该配置文件后是否重启了MySQL服务。如果仍然无法解决问题,可以尝试重新安装MySQL,并且在安装过程中选择使用mysql_native_password作为默认的身份验证插件。
相关问题
执行sudo mysql -u root -p -e 'select @@default_authentication_plugin;'发现还是caching_sha2_password
好的,你的第一个问题是关于MySQL的。你执行了以下命令:sudo mysql -u root -p -e 'select @@default_authentication_plugin;',发现默认的身份验证插件仍然是caching_sha2_password。我理解了你的问题,但是请问你还有其他问题需要我回答吗?
在Ubuntu20.04中的mysql8.0中如何使用--default_authentication_plugin=mysql_native_password运行mysqld
在 Ubuntu 20.04 中安装 MySQL 8.0 后,可以使用以下命令来使用 `--default_authentication_plugin=mysql_native_password` 运行 `mysqld`:
```
sudo mysqld --default_authentication_plugin=mysql_native_password
```
如果你使用的是 systemd 来管理 MySQL 服务,可以在 `/etc/systemd/system/mysqld.service.d/mysqld.conf` 文件中添加以下内容:
```
[Service]
ExecStart=
ExecStart=/usr/sbin/mysqld --default_authentication_plugin=mysql_native_password
```
然后重新加载 systemd 配置并重启 MySQL 服务:
```
sudo systemctl daemon-reload
sudo systemctl restart mysqld
```
需要注意的是,在 MySQL 8.0 中,默认的认证插件是 `caching_sha2_password`,所以如果你使用 `--default_authentication_plugin=mysql_native_password` 参数启动 `mysqld`,则需要创建一个用户并指定其认证插件为 `mysql_native_password`。例如:
```
CREATE USER 'myuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'mypassword';
```
这将创建一个用户名为 `myuser`,密码为 `mypassword`,并使用 `mysql_native_password` 作为认证插件的用户。
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)