Grafana with MySQL: this authentication plugin is not supported - mysql

I am trying to load some data from MySQL to Grafana, but got the following error. Any idea what I missed? Thanks!

Its happends couse grafana don't maintain the new mysql authorization method named caching_sha2_password. Sinse mysql 8 its default setting.
To solve this problem you need just to create new user with mysql_native_password authentication plugin connector.
Step 1. Check the available users and its plugins.
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)
All the users has caching_sha2_password authorization plugin.
Step 2. Open the mysql workbench and connect to database.
Execute the query
CREATE USER 'native_user'#'localhost' IDENTIFIED WITH mysql_native_password;
The result must be like this one
09:30:17 CREATE USER 'native_user'#'localhost' IDENTIFIED WITH mysql_native_password 0 row(s) affected 0.156 sec
Step 3. In mysql workbench open server -> users and privilegas
Select native_user form the list. Change the password, default shema and shema privilegas for this user. Save the changes.
Step 4. Check with 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)
Step 5. Open the grafana datasouces and set up new user.
Good luck!
P.S. I cant create a new user with mysql_native_password using mysql workbanch. Maybe its bug. Use command prompt instead.

Thanks. Below works as well. No need to create a new user.
select user,plugin from mysql.user;
alter user root#'localhost' identified with mysql_native_password by 'my_password';
select user,plugin from mysql.user;

Related

msql password chancing_sha2_password plugin

I can change the password of root#localhost user from auth_socket ==> mysql_native_password, but other users can not change to mysql_native_password;
mysql.session, mysql.sys, debian-sys-maint and phpmyadmin (when I installed phpmyadmin mysql said: ERROR 1819 (HY000) at line 1 error so I couldn't create a record in the database)
I want all users to be able to change mysql_native_password from chancing_sha2_password plugin because; if I can't change plugin methods; I can't use phpmyadmin or other 3 party app.
(mysql said:ERROR 1819(HY000) at line 1)
+------------------+-------------------------------------------+-----------------------+-----------+
| user | authentication_string | plugin | host |
+------------------+-------------------------------------------+-----------------------+-----------+
| root | *91EA82EFAD0677E20FDAEC7F11E15244530996F6 | mysql_native_password | localhost |
| mysql.session | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | caching_sha2_password | localhost |
| mysql.sys | *THISISNOTAVALIDPASSWORDTHATCANBEUSEDHERE | caching_sha2_password | localhost |
| debian-sys-maint | *70B3E55DA437B329F2F1A90C66719B666CBF4B9E | caching_sha2_password | localhost |
+------------------+-------------------------------------------+-----------------------+-----------+
4 rows in set (0.00 sec)
i fixed!!!
firstly;install phpmyadmin and add to apache2 and login mysql password.
On the phpmyadmin screen, the mysql password will give an error, but accept the statement and complete the setup. Then type the following code in the mysql command window!
so far
ALTER USER 'phpmyadmin'#'localhost' IDENTIFIED WITH mysql_native_password BY 'TestPassword123*-';

MySQL Create User Operation failed

I have been trying to create a MySQL user programmatically.
$this->db->query('CREATE USER 'agit****'#'localhost'); // Using Codeigniter
It returns an error
Operation CREATE USER failed for 'agit****'#'localhost'
I have deleted the user from the mysql.user and tried again.
DROP USER 'agit****'#'localhost';
I have also tried
DROP USER 'agit****'#'%';
and
DELETE FROM `mysql.user` WHERE `user` LIKE 'agit****';
The user got deleted and then I executed the following query:
flush privileges;
and restarted the MySQL server. But no use.
I have tried to create the same user from command line, and it returns the following error code
ERROR 1396 (HY000): Operation CREATE USER failed for
Server details and version numbers
SHOW VARIABLES LIKE "%version%";
+-------------------------+------------------------------+
| Variable_name | Value |
+-------------------------+------------------------------+
| innodb_version | 5.5.45 |
| protocol_version | 10 |
| slave_type_conversions | |
| version | 5.5.45 |
| version_comment | MySQL Community Server (GPL) |
| version_compile_machine | x86 |
| version_compile_os | Win64 |
+-------------------------+------------------------------+
7 rows in set (0.00 sec)
Note: This error occurs only when I try to create a user which existed already.
New users can be added without any issue
I have confirmed that the User got deleted from the MySQL.User table before creating the user account again.

How to resolve ERROR 1396 (HY000): Operation ALTER USER failed for 'root'#'localhost'?

I can't login with root ,I think root's password may be changed.But I can't change root's password either.
Mysql version is v8.0.16.
I have used --init-file to specificd alter sql at mysqld booting
alter user 'root'#'localhost' identified by 'mynewpassword'
but it doesn't work.
I used --skip-grant-tables --user=mysql so I could add a new user, and my new user works. I try to alter root,but it failed again.
mysql> alter user 'root'#'localhost' identified by 'mynewpassword';
ERROR 1396 (HY000): Operation ALTER USER failed for 'root'#'localhost'
here is the table user's content
mysql> select user,host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| admin | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
| root | localhost |
+------------------+-----------+
Do anyone have any idea?
You Can try:
ALTER USER 'root'#'%' IDENTIFIED WITH mysql_native_password BY '123';
rather than
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY '123';
When you use the following command
mysql> use mysql;
mysql> select user,host from user;
you can find that root's host is '%'
mysql> select user, host from user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | % |
| mysql.infoschema | localhost |
| mysql.session | localhost |
| mysql.sys | localhost |
+------------------+-----------+
According to the mysql docs and this one - check the special --init-file option.
And then try to FLUSH PRIVILEGES;
Also, please see this related post.
This should help.

Connecting play framework to mysql

I have two databases in mysql:
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| app |
| app_dev |
+--------------------+
I have two play framework servers running, one using app and one using app_dev. The server connecting to app is local to the machine running mysql. The server connecting to app_dev is remote. I think I've setup the permissions correctly:
mysql> show grants for 'app_dev';
+------------------------------------------------------------------+
| Grants for app_dev#% |
+------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'app_dev'#'%' IDENTIFIED BY PASSWORD 'pwd' |
| GRANT ALL PRIVILEGES ON `app_dev`.* TO 'app_dev'#'%' |
+------------------------------------------------------------------+
mysql> show grants for 'app'#'localhost';
+----------------------------------------------------------------------+
| Grants for app#localhost |
+----------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'app'#'localhost' IDENTIFIED BY PASSWORD 'pwd' |
| GRANT ALL PRIVILEGES ON `app`.* TO 'app'#'localhost' |
+----------------------------------------------------------------------+
Yet for some reason, when I try to start play on my development machine, I get the response: MySQLSyntaxErrorException: SELECT command denied to user 'app_dev'#'2.ipn.ipn.ipn' for table 'play_evolutions'.
Is it possible I've set up the permissions incorrectly? The only thing that's different here is the need for the % sign as this is a remote connection!

why can't create a new user in mysql?

mysql> select user,host from mysql.user;
+------------------+-----------+
| user | host |
+------------------+-----------+
| root | 127.0.0.1 |
| root | ::1 |
| debian-sys-maint | localhost |
| developer | localhost |
| jack | localhost |
| root | localhost |
| root | rebuild |
+------------------+-----------+
7 rows in set (0.00 sec)
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
| wpdatabase |
+--------------------+
4 rows in set (0.00 sec)
mysql> CREATE USER wpuser#localhost;
ERROR 1396 (HY000): Operation CREATE USER failed for 'wpuser'#'localhost'
Why can't create a new user in mysql? The user wpuser is not in the table user.
I neved used databases, so can anyone help me on how to create a new user ?
No,it is not the problem of password(123456 is the key of mysql database).
mysql> CREATE USER 'wpuser'#'localhost' IDENTIFIED BY '123456';
ERROR 1396 (HY000): Operation CREATE USER failed for 'wpuser'#'localhost'
It is so strange ,please go on .
Why CREATE USER wpuser#localhost; can't ; CREATE USER wpusers#localhost; can?
I had the same problem I believe. I accidentally created 'myuser', deleted it using the command below, and then I cannot create the user, although its not showing up on mysql.user table
I tried these commands for deleting but to no avail.
delete user from mysql.user where user='myuser'
delete user from mysql.user where user='myuser' and host='localhost'
delete user from mysql.user where user='myuser' and host='%'
It worked for me when I use this command to remove the user.
DROP USER 'myuser'#'localhost';
In between trying out these commands I FLUSH PRIVILEGES as though I'm on diarrhoea. So in case it still does not work, do what Begueradj suggested.
The user you want to creat must have a MySQL password:
CREATE USER 'wpuser'#'localhost' IDENTIFIED BY 'password';
Then give him permissions:
GRANT ALL PRIVILEGES ON * . * TO 'wpuser'#'localhost';
Do not forget to reload all the privileges:
FLUSH PRIVILEGES;
Hope this helps you.
For me, I got this error in mysql workbench on trying to re-add a user that I had in the DB, but then I tried this query & found that the user was actually added:
select user, host from mysql.user
So I suggest if someone gets that error in mysql workbench to try this query as a first measure before the more complex solutions as the user might be already created.