Navicat连接mysql8.0:提示无法加载身份验证插件“caching_sha2_password”

news/2024/7/24 11:27:49 标签: mysql, adb

Navicat连接mysql时,提示:Unable to load authentication plugin ‘caching_sha2_password‘.

原因:mysql 8.0 默认使用 caching_sha2_password 身份验证机制。
在这里插入图片描述

D:\MySQL8.0\install\bin>mysql -uroot -p123456789   #登录
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql
Database changed
mysql> select user,host,plugin,authentication_string from user;    #查看用户信息

在这里插入图片描述

修改身份验证机制

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';    #修改身份验证机制

更改过程:

mysql> mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';    #修改身份验证机制
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '4' at line 1
mysql> ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '123456';
Query OK, 0 rows affected (0.07 sec)

mysql> ALTER USER 'pokes'@'%' IDENTIFIED WITH mysql_native_password BY '123456';   #修改身份验证机制 
Query OK, 0 rows affected (0.06 sec)

mysql>

MYSQL8.0开启远程链接

mysql -uroot -p123456
grant all privileges on *.* to 'root'@'%'identified by 'youpassword' with grant option;  #开启远程访问
mysql> CREATE USER 'pokes'@'%' IDENTIFIED BY '123456';		#新建一个用户
mysql> GRANT ALL PRIVILEGES ON *.* TO 'pokes'@'%' WITH GRANT OPTION;   #授权
mysql> FLUSH PRIVILEGES;    #刷新
D:\MySQL8.0\install\bin>mysql -uroot -p123456
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 19
Server version: 8.0.32 MySQL Community Server - GPL

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> grant all privileges on *.* to 'root'@'%'identified by 'youpassword' with grant option;
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'identified by 'youpassword' with grant option' at line 1
mysql> CREATE USER 'pokes'@'%' IDENTIFIED BY '123456';
Query OK, 0 rows affected (0.63 sec)

mysql> GRANT ALL PRIVILEGES ON *.* TO 'pokes'@'%' WITH GRANT OPTION;
Query OK, 0 rows affected (0.06 sec)

mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.08 sec)

mysql>


![在这里插入图片描述](https://img-blog.csdnimg.cn/afbaa2a3499f4a3e847bd434e6aa1e72.png)




http://www.niftyadmin.cn/n/5008410.html

相关文章

MYSQL学习之——管理用户

MYSQL学习之——管理用户(DCL) 用户这个东西其实是一个和TABLE DATABASE 这种东西一样的并列关键字。 用户的管理无外乎几个操作 查看用户 添加用户 删除用户 更新用户名或密码 改变用户对数据库的操作权限。 MYSQL语句功能备注USE mysql; select * FR…

js 根据键判断值

最原始的写法&#xff1a; 改进后的写法&#xff1a; const DeviceTypeObj {SO2: "SO<sub>2</sub>",CO: "CO",NO: "NO",NO2: "NO<sub>2</sub>",O3: "O<sub>3</sub>", let value Dev…

pip安装mysqlclient报错 Exception: Can not find valid pkg-config name

今天docker内搭建python3.10环境时报这个错误&#xff0c;安装 mysqlclient 时报错。 WARNING: The directory /home/seluser/.cache/pip or its parent directory is not owned or is not writable by the current user. The cache has been disabled. Check the permissions…

使用“vue init mpvue/mpvue-quickstart“初始化mpvue项目时出现的错误及解决办法

当使用"vue init mpvue/mpvue-quickstart"初始化 mpvue 项目时出现 "vue-cli Failed to download repo mpvue/mpvue-quickstart: connect ETIMEDOUT IP地址"原因是 github 的 IP 解析失败&#xff0c;连接超时 解决办法&#xff1a;更改最新的 github 的 …

【LeetCode】301.删除无效的括号

题目 给你一个由若干括号和字母组成的字符串 s &#xff0c;删除最小数量的无效括号&#xff0c;使得输入的字符串有效。 返回所有可能的结果。答案可以按 任意顺序 返回。 示例 1&#xff1a; 输入&#xff1a;s "()())()" 输出&#xff1a;["(())()"…

Solidity 小白教程:10. 控制流,用 solidity 实现插入排序

Solidity 小白教程&#xff1a;10. 控制流&#xff0c;用 solidity 实现插入排序 这一讲&#xff0c;我们将介绍solidity中的控制流&#xff0c;然后讲如何用solidity实现插入排序&#xff08;InsertionSort&#xff09;&#xff0c;一个看起来简单&#xff0c;但实际上很容易…

MySQL 中 MyISAM 与 InnoDB 引擎的区别

分析&回答 区别很多&#xff0c;大家说出下面几点&#xff0c;面试就应该 OK 了 1) 事务支持 MyISAM不支持事务&#xff0c;而InnoDB支持。InnoDB的AUTOCOMMIT默认是打开的&#xff0c;即每条SQL语句会默认被封装成一个事务&#xff0c;自动提交&#xff0c;这样会影响速…

postgre 12.11单实例安装文档

一 下载 访问https://www.postgresql.org/download/&#xff0c;点击左侧的‘source进行下载&#xff0c;一般选择bz2的安装包。 二 安装 这里安装12.11版本的postgre&#xff0c;数据目录路径为/data/server/pgdata&#xff0c;端口为5432. 2.1 安装依赖包 #安装 yum in…