I'm a beginner at this so I apologize if this is a fairly simple problem. I am setting up a Galera cluster using two RHEL6 vms. The first node set up on vm no.1 went fine, but as I went to set up the permissions on vm no.2 with the following command:
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root'#'%' IDENTIFIED BY 'password' WITH GRANT OPTION;"
mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root'#'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;"
I get the following error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: NO)
Can anyone tell me how I might go about fixing/troubleshooting this problem?
I am using the root account for the set up.
Thanks in advance!
You have changed the password for root user and therefore you need to use new password during next logins.
To enter password, use parameter -p
e.g. mysql -u root -p -e "your command"
Try this:
mysql> FLUSH PRIVILEGES;
Related
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;
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'
Hi I have followed the instructions mentioned on Mysql reset root users to default. (answer by Nthalk) But I get a new error. My intent is that root should get all permissions.
Any ways to get over this issue ?
mysql> grant all privileges on *.* to 'root'#'localhost' identified by "" with grant option;
ERROR 1045 (28000): Access denied for user ''#'localhost' (using password: NO)
You can't do this without being logged in as root to start with:
mysql -u root
The best way to change the password is:
mysqladmin -u root password 'new password'
I have been used following command but it was not working.
GRANT ALL PRIVILEGES ON *.* TO ROOT#LOCALHOST IDENTIFIED BY "my_password";
You are not connected (in the way of a login & username) to the database, you need to connect. depending on the way you acces the database.
in command line, you can use this:
mysql -pYourpassword -u username
I create a new mysql user by using
CREATE USER 'new-username'#'localhost' IDENTIFIED BY 'new-password';
GRANT ALL ON *.* TO 'new-username'#'localhost' WITH GRANT OPTION;
And I can access mysql by
mysql -u new-username
But I got this error message when I try to access mysql using password
mysql -u new-username -p
error message
ERROR 1045 (28000): Access denied for user 'new-username'#'localhost' (using password: YES)
Something I am missing? Mysql version is Server version: 5.5.24-0ubuntu0.12.04.1 (Ubuntu)
Thanks
Here you required to pass password but you dont have entered any password.
CREATE USER 'new-username'#'localhost' IDENTIFIED BY 'new-password';
GRANT ALL ON *.* TO 'new-username'#'localhost' WITH GRANT OPTION;
mysql -u new-username -p new-password
And if you want to remove password from that then just use following line
SET PASSWORD FOR 'new-username'#'localhost' = ''