Although a variation of this question has been asked before it did not help. Link for anyone interested.
mysql> GRANT SUPER ON *.* TO root#'%' IDENTIFIED BY 'password';
I ran the above command but I receive the following error, even though I am the root user:
Access denied for user 'root'#'%' (using password: YES)
I have also create a custom Parameter Group and set the log_bin_trust_function_creators=1 and rebooted the instance, but still I don't have Super Privileges. Any ideas?
You cannot grant SUPER on an Aurora (or any RDS) database.
Some things that require SUPER can be set via the parameter group settings, and there are some built-in stored procedures for some other common task.
Related
I am trying to run the following command in MySQL as the root user:
set global log_bin_trust_function_creators=1;
However, this gives me the following error:
Access denied; you need (at least one of) the SUPER privilege(s) for this operation
To overcome this, I tried to grant the SUPER privilege to the root user by running:
GRANT SUPER ON *.* TO 'root'#'my-host' IDENTIFIED BY 'my-password';
This in turn gives me the error:
Access denied for user 'root'#'%' (using password: YES).
So I am not really sure what to do. The MySQL version is 5.7.36 and I am connecting to the database remotely. The root user is also set to mysql_native_password as well. Any ideas on what I can do?
This database was part of Google Cloud SQL and with managed databases like this and Amazon RDS, SUPER privileges are not supported. To enable this parameter, you need to set it through the Google Cloud SQL flags or in case of Amazon RDS, the parameter group.
I switch to MySQL 8 recently; earlier I was using MySQL 5.7 in GCP. I know questions like this have already been asked, but I didn't have any luck. My question is, I want to create a new user just say 'user1' and grant all privileges to a user account on all databases.
The query I am using for user creation:
CREATE USER 'user-1'#'%' IDENTIFIED BY 'user_password';
For privileges:
GRANT ALL PRIVILEGES ON *.* TO 'user-1'#'%';
This privileges query used to work on MySQL 5.7, but when I try to run this query in MySQL 8, I get this error (I logged in as root user and MySQL is in GCP):
SQL Error (1045): Access denied for user 'root'#'%' (using password: YES)
I also tried to run this query one after another like this:
CREATE USER 'user-1'#'%' IDENTIFIED BY 'user_password';
GRANT ALL PRIVILEGES ON *.* TO 'user-1'#'%';
But still I get the same error. I came to know that in MySQL 8 localhost root user have all the privileges, but my server is in Google Cloud, so how can I grant all the privileges to the user I created?
When I run this query in the mysql-8 (I am using HeidiSQL to connect the DB and run query)
SELECT * FROM mysql.user;
I got this output:
In this there are two root users:
For one host is localhost/127.0.0.1 (With all the privilege).
For other host is % (Not have any privilege).
I think I logged in as a user with host-% because my server is in GCP, that's why I cannot give any privilege to the user that I have created. So is there any way to give full permission to the
root#%
so that I can give full permission to the other users, Because I don't think there is any way to log in as a root#localhost
The problem here is that you are trying to create a super user, which is not something supported in cloud SQL, as you can see in this documentation:
Cloud SQL does not support SUPER privileges, which means that GRANT ALL PRIVILEGES statements will not work. As an alternative, you can use GRANT ALL ON %.*.
This alternative mentioned could be enough to grant the permissions you expected.
I'm logged in as root user to an Amazon RDS MySql 5.7 database from MySql workbench.
I've added a user via the following command:
CREATE USER 'my_user'#'%' IDENTIFIED BY 'mypassword';
I'm trying to grant access to the user via this command:
GRANT ALL ON *.* TO 'my_user'#'%'
However, this returns the error:
Error Code: 1045. Access denied for user 'root'#'%' (using password: YES)
I'm not sure if this should work if the user already exists, so based in this post:
https://serverfault.com/questions/115950/how-do-i-change-the-privileges-for-mysql-user-that-is-already-created
I also tried this command:
revoke all privileges on *.* from 'my_user'#'%'
However, I receive the same result. I also had the same problem when I tried creating the user with the GRANT command.
Any help appreciated.
This isn't an answer, but I think the root user might be restricted on RDS. When I did a native install of mysql, the command worked.
None other than RDS user can't have the root user privileges.
I am trying to have a simple mysql Database on a server and another database on another server that connects to it.
I have done the following :
Installed mysql-server
Created the database
Created the user with :
CREATE USER admin#'localhost' IDENTIFIED BY 'admin';
Given the privileges to this user with :
GRANT ALL PRIVILEGES ON confWeb.* TO admin#'';
Opened the bind-adress
Now when I launch the command mysql -u admin -p -h <address> from another server, it just tells me again and again :
ERROR 1045 (28000): Access denied for user 'admin'#'X.X.X.X' (using password: YES)
I really have no idea what to do at this point. I think I've tried everything.
I tried putting GRANT OPTION in the end of the GRANT line, I tried allowing a lot of different addresses but nothing worked.
In MySQL, a user is identified by both user and host.
This user:
admin#localhost
is not the same user as
admin#'10.242.167.235'
As one option, you could do this to allow connection:
GRANT USAGE ON *.* TO admin#'10.242.167.235' IDENTIFIED BY 'mysecret' ;
GRANT ALL ON confWeb.* TO admin#'10.242.167.235' ;
For a longer discussion of the MySQL Access Privilege System, including "wildcards", the special meaning of localhost, using IP addresses instead of hostnames, etc.
http://dev.mysql.com/doc/refman/5.7/en/privilege-system.html
I do not really know why, but appareantly, it worked when I used the with grant option and first gave access to the database, and then to its tables.
Here is the list of commands that I entered :
mysql> create user 'admin'#'localhost' identified by 'admin';
mysql> grant all privileges on confWeb to 'admin'#'10.69.101.%' identified by 'admin' with grant option;
mysql> grant all privileges on confWeb.* to 'admin'#'10.69.101.%' identified by 'admin' with grant option;
mysql> flush privileges;
Again, I don't really know why it didn't work before and the answers that I saw look like all the documentation I have seen but it looks my problem was somewhere else.
Use following step:-
CREATE USER 'user name'#'IP or % or localhost' IDENTIFIED BY 'password';
GRANT all privileges ON *.* TO 'user name'#'IP or % or localhost' IDENTIFIED BY 'password' ;
flush privileges;
Here in the place of "IP"; you use remote server ip where you want to connect the server.You can also use "%" for useage databases from any plcae in the world.
Now, in Grant option; In the place of "all privileges" you can given access seperately like as select,alter,update etc.
I want to create a new mysql user and database demo in my company. Here is the commands i input in the mysql.exe :
create user 'admin'#'localhost' identified by 'admin';
create database dem;
Everytime i have that response:
access denied for user ''#'localhost' to database.
Actually i refered to that similar question :
MySQL - Access denied for user
Can anyone help please ???
I would suggest creating the database first then you can create a user, and use the GRANT option to allow permissions to that user for whatever you find necessary. However, creating a user first then a database while it's able to "potentially" work, isn't the best practice with MySQL. So you want to effectively do the Steps as such:
Create Database
Create User
GRANT permissions
???
Profit
You have to GRANT access to admin for dem.
GRANT ALL PRIVILEGES ON *.* TO 'admin'#'%' WITH GRANT OPTION;
You may have to also GRANT the same for admin#localhost as well. IIRC if you ever logon remotely with admin you would inherit the base privileges unless otherwise GRANTed
You can find many answers HERE.