Access denied on MySQL database - mysql

I have granted all privileges to username:
GRANT ALL PRIVILEGES ON my_db . * TO 'website_user'#'xx.xx.xx.xx' IDENTIFIED BY 'password'
Trying to access database which is in yy.yy.yy.yy from xx.xx.xx.xx:
mysqldump -P 3306 -u website_user -ppassword -h yy.yy.yy.yy my_db > test.sql
But still getting below error:
mysqldump: Got error: 1045: Access denied for user 'website_user'#'xx.xx.xx.xx' (using password: YES) when trying to connect
I also checked firewall. Nothing is preventing to run this query. What am I doing wrong?

Have you also run the following query:
FLUSH PRIVILEGES
That is required to make the new permissions to take effect.

Related

I am trying to start mysql-client in Docker but i get access denied for user error

I am trying to connect MySQL Client to docker. I can connect just fine on the MySQL 8.0 Command Line Client, but when I try to connect to it from docker I get this error:
C:\Users\Bolin>docker exec -it mysql mysql -u root -p
Enter password:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
I am on a window machine and I am trying to follow this tutorial
https://phoenixnap.com/kb/mysql-docker-container
hmm, looks like the issue is with privilege user for the database table,
Try to create a privileged user in your database named root. After that please check again
==========================================================================================
try these queries in your databse:
INSERT INTO mysql.user (Host, User, Password) VALUES ('%', 'root', password('YOURPASSWORD'));
GRANT ALL ON *.* TO 'root'#'%' WITH GRANT OPTION;
if the above code doesn't work try with the second
$mysql -u root mysql
$mysql> UPDATE user SET Password=PASSWORD('my_password') where USER='root';
$mysql> FLUSH PRIVILEGES;

How do I solve access issues?

When I log into the server with
[mysql -u rayzer5_root -p'***********' -h 173.231.211.221]
It connects but I cannot access my database.
When I try to log in with
[mysql -u rayzer5_root -p'***********' -h 173.231.211.221 -D rayzer5_orange_db
I get
ERROR 1045 (28000): Access denied for user 'rayzer5_root'#'c-98-249-0-68.hsd1.va.comcast.net' (using password: YES)
When I am signed in with [mysql -u rayzer5_root -p'*********' -h 173.231.211.221] I can use SHOW GRANTS; and I get
Grants for rayzer5_root#98.249.0.68
GRANT USAGE ON *.* TO 'rayzer5_root'#'98.249.0.68' IDENTIFIED BY PASSWORD '*50A18D5B2BECC59BC9EEA4702519B53063772CBD'
GRANT ALL PRIVILEGES ON `rayzer5\_orange\_db`.* TO 'rayzer5_root'#'98.249.0.68'
How do I get the server to see me as rayzer5_root'#'98.249.0.68 rather than Rayzer5_root'#'c-98-249-0-68.hsd1.va.comcast.net?

How to enable remote login for mysql.?

I have two nodes: node1 and node2. I want to access MySQL installed on node1 from node2.
I have so far tried using grant all privileges on *.* to 'mysql'#'node2.openstacklocal' with grant option; on MySQL but I still get the below error:
===ERROR===
[mysql#node2 ~]$ mysql -p -h mgmt.openstacklocal -u mysql -P 3306
Enter password:
ERROR 1045 (28000): Access denied for user 'mysql'#'node2.openstacklocal' (using password: YES)
I guess I got the solution
Login to mysql
Run command
grant all on mysql.* to '<remoteuser>'#'node2.openstacklocal' identified by 'password';
Note - Notice this command is missing word 'privileges'

error: 1045: Access denied for user 'user'#'123.10.123.123' (using password: NO) when trying to connect

I am trying to get a local snapshot of a database by running this command:
mysqldump --single-transaction --quick -u user -ppass -h somehost db_name | mysql -u user -ppass -h localhost db_name
Even though this has worked for me in the past, I am now getting this error back:
error: 1045: Access denied for user 'user'#'123.10.123.123' (using password: NO) when trying to connect
I can successfully log in with the username and password above:
mysql -u user -ppass -h localhost
and I have previously granted privileges to the user for the local database, e.g.
grant all on db_name.* to user;
I also find it strange that the error message is returning user#my_ip_address instead of user#localhost when I have specified localhost as the host. I'm also confused as to why it says using password: NO, as I've also provided a password.
It turns out that the remote host that I was attempting to download from had changed. Using the correct new hostname solved the problem.

MYSQL ERROR 1045 (28000): Access denied for user 'usernamei'#'hostname' (using password: YES)

HI guys I got this Error and after Looking Around, the suggestion is that the password is wrong but I do not Understand how the Password Can be wrong because I can connect using the same details using phpMyadmin. Why should the Commandline give me this error?
I have been connecting using the command:
mysql -h db.gatungo.gskool.com -u mungai -p
Enter password: **********
ERROR 1045 (28000): Access denied for user 'mungai'#'212.22.177.50' (using password: YES)
Try to change hostname to localhost or 127.0.0.1.
I don't believe hostname is a valid host.
Note that you also have the username as usernamei
mysql -u usernamei -h localhost -p
Also make sure you have access from outside for that user:
GRANT USAGE ON *.* TO 'mungai'#'%' IDENTIFIED BY 'YOUR_PASSWORD';