Grafana MySQL isn't using the given password - mysql

I'm trying to use Grafana MySQL to gather metrics on my database.
However, I cannot access the database from the plugin even if I can from MySQL Workbench or Datagrip.
My configuration is the following:
- name: MySQL
type: mysql
URL: <my_host>:3306
database: csc648
user: <user>
isDefault: false
secureJsonData:
password: "<my_password>"
jsonData:
maxOpenConns: 0 # Grafana v5.4+
maxIdleConns: 2 # Grafana v5.4+
connMaxLifetime: 14400 # Grafana v5.4+
I created a special user with only read access. This user works but not with the plugin.
Here's the request I used
CREATE USER '<user>'#'%' IDENTIFIED BY '<my_password>';
GRANT SELECT ON <database>.* TO '<user>'#'%';
FLUSH PRIVILEGES;
SHOW GRANTS FOR '<user>'#'%';
The error thrown by the UI is
db query error: query failed - please inspect Grafana server log for details
And when I look at the log I see the following error
Error 1045: Access denied for user '<my_user>'#'<host>' (using password: NO)"
I do not understand why it says using password: NO since I provide one.
I get the same error if I try from the UI too...
I'm using grafana/grafana:9.3.6 docker image.

Related

Cannot connect to mysql datavbase ERROR Access denied for user... (using password: YES)

Running a php script or trying to connect via terminal (locally) I get the same error
Access denied for user... (using password: YES)
mysql -u username -p'password' -h ip db_name
It passes to the server but get's blocked because of password although correct value was provided.
I've tried several fixes associated to this scenario but to no avail.
When a tried to execute some queries which could provide extra info for the fix, I get
1142 - SELECT command denied to user ... for table 'user'
I've assigned username, password and all privileges in cPanel MySql databases section (for the database) but am unable to connect using the created user as if a root user is blocking access to the database.
Am on GoDaddy host.
These are the only actions that I can preform on my database

PDOException::("PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109") with MySQL 8 / PHP 7.2 / Laravel

I just installed my dev environnement.
When I try to connect mysql db via SequelPro, I get:
Authentication plugin 'caching_sha2_password' cannot be loaded
As stated in: Authentication plugin 'caching_sha2_password' cannot be loaded, I ran:
ALTER USER 'root'#'localhost' IDENTIFIED WITH mysql_native_password BY '';
Then I could connect my DB via SequelPro
But when I execute Laravel Command:
php artisan migrate
I get:
PDOException::("PDO::__construct(): Unexpected server respose while doing caching_sha2 auth: 109")
What should I do now ?
PD: I use Laravel Valet on Mac, and Laravel 5.6.
You must alter use in your laravel app via shell with mysql command
ALTER USER 'user'#'localhost' IDENTIFIED WITH caching_sha2_password BY 'your password';
ALTER USER 'user'#'%' IDENTIFIED WITH caching_sha2_password BY 'your password';
the problem is good for safety, mybe.
but I use the command solve the problem:
ALTER USER root#localhost IDENTIFIED WITH caching_sha2_password BY 'password';
restart mysql
try now
Hope you will not see this error again.
After using $ mysql -uUser -pPa$$w0rd the MySQL connection could be opened with PHP using mysqli_real_connect() or PDO
Make sure that the User has caching sha2 password active, not a native password. (PHP 7.2.9-1, MySQL 8.0.12)
When changing to a native password PHP says
mysqli::real_connect(): Unexpected server respose while doing caching_sha2 auth: 109
With caching sha2 password active i always get:
mysqli::real_connect(): (HY000/1045): Access denied for user 'User'#'localhost' (using password: YES)
So tried to login from Shell using $ mysql, which succeeded, after this, i was able to connect with PHP. Seems like a Bug in the PHP mysqlnd.
Implementing a shell_exec('mysql -u'.$user.' -p"'.$password.'" -e quit > /dev/null 2>&1'); right before opening the MySQL connection, solves the issue, by now, for me.
Rebooting or restarting the MySQL Service, resets the cached password and the access denied message will pop again.
Hope this helps.
Greetings

Cannot connect remotelly to a mariadb server

I'm trying to connect to a mariadb server remotelly using terminal, but I get a little issue about that.
Preconditions
I have connection to my remote server, and I can enter inside maria db using the next command
mysql -u root -p**** and I enter without problems.
Also I have commented this line of my.conf from the #bind-address = 127.0.0.1.
When I'm trying to do this from my computer mysql -u root -h mariadb.testing.des -p**** I get the following error in console
ERROR 1045 (28000): Access denied for user 'root'#'mariadb.testing.des' (using password: YES)
Why am I getting two different results using the same user? What am I doing wrong?
Thanks for the help,
Jaster.
It's not enough to ensure your server is reachable from remote. You also have to create a user which has privileges for the remote access to your desired schema. I strongly recommend not to create a remote root user with access to all. Best practice is to create a remote user for every single scheme.
In example:
CREATE USER 'jeffrey'#'my.remote.host' IDENTIFIED BY 'mypass';
GRANT ALL ON jeffreys_db.* TO 'jeffrey'#'my.remote.host';
See also:
https://dev.mysql.com/doc/refman/5.7/en/create-user.html
https://dev.mysql.com/doc/refman/5.7/en/grant.html

Mysql - 1045 - Access denied for user 'user'#'localhost' (using Password: Yes)

I have installed MYSQL 5.6 stand-alone on a local windows server. Recently, I changed the local IP of my server and reconfigured it in my network, but now I am not able to access my databases. It is giving me this error:
1045 - Access denied for user 'user'#'localhost' (using Password: Yes)
The above error is coming while using localhost as the server name. Also, I am able to connect to localhost through root username, but it is not showing me the original DB's which I had before.
Also before the server IP change I was able to access the MySQL server through the old IP of the server. like host name: xx:xx:xx:xx , user: user, pass: pass .... But it is also giving me an error:
2003 - cannot connect to my sql server on 'xx:xx:xx:xx' (10038)
I have tried the solution define on following link and run following query:
https://dev.mysql.com/doc/mysql-windows-excerpt/5.6/en/resetting-permissions-windows.html
SET PASSWORD FOR 'root'#'%' = PASSWORD('test');
and this is starting giving error of access denied for the root username and password 'test'
Can any body help me to resolve this.
Connect to 127.0.0.1 as root.
Update IP address for mysql user row with old IP address.
use mysql;
update user set host='NEWIP' where host='OLDIP' and user='root';
flush privileges;
Try again to connect.
If you don't have root access, reset permissions and try again.
http://dev.mysql.com/doc/refman/5.7/en/resetting-permissions.html
This is a problem experienced by people who downloaded the recent version (i.e MySQL 5.7.10)
The problem is there is a temporary password for this version
after you typed in bin>mysql -u root -p ...
you have to type in the password which is different for every person who downloaded it. Go to your mysql directory in C (or wherever you extracted it to) , go to the file 'data'. There would be an ERR file with your computer's name on it.
Open that file using notepad
in the 6th line of commands, there would be a line as follows
[Note] A temporary password is generated for root#localhost: '(your password)'
copy that password and paste it in the command prompt ... From there on you can continue as shown in the video

Heroku db:push Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user 'reg'#'localhost ' (using password: NO)

I have a problem using the heroku db:push command to transfer a MySQL database to heroku. I've tried using the same command for another app with a sqlite3 database and everything went fine.
C:\Users\reg\Team-Omni>heroku db:push
Loaded Taps v0.3.9
Auto-detected local database: mysql://127.0.0.1/omni_dev?encoding=utf8
Warning: Data in the app 'growing-mist-42' will be overwritten and will not be recoverable
.
Are you sure you wish to continue? (y/n)? y
Failed to connect to database:
Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user 'reg'#'localhost
' (using password: NO)
if i remove the password for the mysql anonymous account, the error changes to
Sequel::DatabaseConnectionError -> Mysql::Error: Access denied for user ''#'localhost' to database 'omni_dev'
--additional information--
my .gems file:
rails -v 2.3.8
andre-geokit --version 1.5.0 --source http://gems.github.com
You are getting that error because you are not specifying the password for the local database connection. Apparently the username is configured as 'reg' (maybe in the MySQL config file). This doesn't have anything to do with the Heroku PostgreSQL database, it's a problem connecting to your local MySQL database (named omni_dev).
Try the following connection string:
mysql://USERNAME:PASSWORD#127.0.0.1/omni_dev?encoding=utf8
for the appropriate values of USERNAME and PASSWORD.
I've had this problem as well, but I was passing a password. My local app worked fine, but when using heroku db:push, I got the same error as redge.
Adding a port in the database.yml fixed the problem. So, a working database.yml has the following entries:
database: DATABASE
username: USER
password: PASSWORD
adapter: mysql
encoding: utf8
socket: /Applications/MAMP/tmp/mysql/mysql.sock
port: 8889