首页 > 解决方案 > Grafana 与 MySQL:不支持此身份验证插件

问题描述

我正在尝试将一些数据从 MySQL 加载到 Grafana,但出现以下错误。知道我错过了什么吗?谢谢!

在此处输入图像描述

标签: mysqlgrafana

解决方案


它的偶然原因是grafana不维护名为caching_sha2_password. 将 mysql 8设置为默认设置。要解决此问题,您只需使用mysql_native_password身份验证插件连接器创建新用户。

步骤 1. 检查可用用户及其插件。

MySQL [localhost+ ssl] SQL> select user, plugin from mysql.user;
+------------------+-----------------------+
| user             | plugin                |
+------------------+-----------------------+
| pi               | caching_sha2_password |
| mysql.infoschema | caching_sha2_password |
| mysql.session    | caching_sha2_password |
| mysql.sys        | caching_sha2_password |
| root             | caching_sha2_password |
+------------------+-----------------------+
6 rows in set (0.0011 sec)

所有用户都有caching_sha2_password授权插件。

步骤 2. 打开 mysql 工作台并连接到数据库。

执行查询

CREATE USER 'native_user'@'localhost' IDENTIFIED WITH mysql_native_password;

结果一定是这样的

09:30:17    CREATE USER 'native_user'@'localhost' IDENTIFIED WITH mysql_native_password 0 row(s) affected   0.156 sec

步骤 3. 在 mysql workbench 中打开服务器 -> 用户和权限

从列表中选择 native_user。更改此用户的密码、默认 shema 和 shema 权限。保存更改。

步骤 4. 使用 mysql shell 检查

MySQL [localhost+ ssl] SQL> select user, plugin from mysql.user ;
+------------------+-----------------------+
| user             | plugin                |
+------------------+-----------------------+
| pi               | caching_sha2_password |
| mysql.infoschema | caching_sha2_password |
| mysql.session    | caching_sha2_password |
| mysql.sys        | caching_sha2_password |
| native_user      | mysql_native_password |
| root             | caching_sha2_password |
+------------------+-----------------------+
6 rows in set (0.0011 sec)

步骤 5. 打开 grafana 数据源并设置新用户。

祝你好运!

mysql_native_passwordPS 我无法使用 mysql 工作台创建新用户。也许它的错误。请改用命令提示符。


推荐阅读