How to grant access to root on mysql? - mysql

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'

Related

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'

I can't login with Mariadb root

I'm connected to my cloud. I can login with Mariadb root with this command:
mysql -u root -p
Then I created a new user bill with host %
CREATE USER 'bill'#'%' IDENTIFIED BY 'passpass';
Granted all the privileges to user bill:
grant all privileges on *.* to 'bill'#'%' with grant option;
when i entered it I got this error:
ERROR 1045 (28000): Access denied for user 'root'#'%' (using password: YES)
Please give me answer as soon as possible.
Thanks in advance.

How to create a user and assign a password in mysql

What is going on with the below? Why will mysql not let me in? I am using 5.6
root#ip-10-93-145-98:/home/ubuntu# echo "grant all privileges on *.* to 'really'#'%' identified by 'stupid';" | mysql -u root -ptest101
Warning: Using a password on the command line interface can be insecure.
root#ip-10-93-145-98:/home/ubuntu# mysql -u really -pstupid
Warning: Using a password on the command line interface can be insecure.
ERROR 1045 (28000): Access denied for user 'really'#'localhost' (using password: YES)
Run a FLUSH PRIVILEGES after the GRANT ...
Try to login again after that.

Problems setting up MySQL/MariaDB galera cluster

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;

can access my sql without using password but cannot access with password

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' = ''