How to set SUPER privilege for a database - mysql

When I import data and got below problem(error-1) When I try to google it and from the link http://dev.mysql.com/doc/refman/5.6/en/grant.html#grant-privileges I check out Global Privileges and use this id dql editor - GRANT ALL ON . TO 'dev-1'#'localhost'; Which give me error -2
error-1
SQL query:
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`ars_user465`#`%` SQL SECURITY DEFINER */
/*!50001 VIEW `constantcontact_customers_agents` AS select `customers`.`CustomerID` AS `CustomerID`,`customers`.`AgentID` AS `AgentID`,`customers`.`AccountType` AS `CustomerAccountType`,`customers`.`FirstName` AS `CustomerFirstName`,`customers`.`LastName` AS `CustomerLastName`,`customers`.`Address` AS `CustomerAddress`,`customers`.`City` AS `CustomerCity`,`customers`.`State` AS `CustomerState`,`customers`.`Zip` AS `CustomerZip`,`customers`.`Phone` AS `CustomerPhone`,`customers`.`Cell` AS `CustomerCell`,`customers`.`Fax` AS `CustomerFax`,`customers`.`Email` AS `CustomerEmail`,`customers`.`Dob` AS `CustomerDob`,`agents`.`FirstName` AS `AgentFirstName`,`agents`.`LastName` AS `AgentLastName`,`agents`.`CompanyName` AS `AgentCompanyName`,`agents`.`ApiUsername` AS `ApiUsername`,`agents`.`ApiPassword` AS `ApiPassword` from (`customers` join `agents` on((`customers`.`AgentID` = `agents`.`AgentID`)[...]
MySQL said:
#1227 - Access denied; you need the SUPER privilege for this operation
error -2 :
#1045 - Access denied for user 'dev-1'#'%' (using password: YES)

error1: The user you are logged in with needs the super privilege.
Error: 1227 SQLSTATE: 42000 (ER_SPECIFIC_ACCESS_DENIED_ERROR) Message:
Access denied; you need the %s privilege for this operation
error2: Most likely, the user you are logged in with (dev-1#%) doesn't have the Grant privilege.
Run SELECT USER(), CURRENT_USER(); to confirm you are logged in as the user you think you are.
Then run SELECT user,host,grant_priv from mysql.user where grant_priv = 'Y'; To confirm if that user has the GRANT privilege. If not you will need to log as a user with the GRANT privilege to assign the super privilege. (quite often these users are localhost only be default).

Related

Database permits main user 'in' but cannot 'see' any schemas

I'm on RDS and this is the situation:
Unable to progress with my RDS instance.
RDS instance master user is 'admin'
Can connect up to the instance using the admin user (MySQL WB or commandLine):
C:\Users\xx>mysql -u 'admin' -p --host=md-blahblah-db-instance.blahblah.ap-southeast-rds.amazonaws.com
Enter password: ********
Welcome to the MySQL monitor. etc etc
Type '\c' to clear the current input statement.
Now I'm in but (on MySQL WB or commandLine) cannot 'see' schema:
mysql> use uxxx
ERROR 1044 (42000): Access denied for user 'admin'#'fxxxx.lnk.telstra.net' to database 'uxxx'
mysql> GRANT ALL PRIVILEGES ON umb.* TO 'admin'#'%' WITH GRANT OPTION;
ERROR 1044 (42000): Access denied for user 'admin'#'fxxxx.lnk.telstra.net' to database 'uxxx'
mysql> GRANT ALL PRIVILEGES ON umb.* TO 'admin'#'%' IDENTIFIED BY 'somepass';
ERROR 1044 (42000): Access denied for user 'admin'#'fxxxx.lnk.telstra.net' to database 'uxxx'
mysql> CREATE USER test identified by 'password';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
mysql> flush privileges;
ERROR 1227 (42000): Access denied; you need (at least one of) the RELOAD privilege(s) for this operation
Have tried using ideas from the accepted answer at User cannot see databases in mysql workbench
but can't progress as can't create another user.
MySQL ERROR 1045 (28000): Access denied for user 'bill'#'localhost' (using password: YES) suggests that I have could possibly have another user named admin#'fxxxx.lnk.telstra.net', hence this problem.
Quoting:
Hence, such an anonymous user would "mask" any other user like '[any_username]'#'%' when connecting from localhost.
'bill'#'localhost' does match 'bill'#'%', but would match (e.g.) ''#'localhost' beforehand.
The recommended solution is to drop this anonymous user (this is usually a good thing to do anyways).
Reluctant to start again as a lot of CloudFormation stacks are associated with this database.
Any ideas? Appreciate all help.

google cloud sql -- mysql import issue

I am trying to import a table in a newly created instance in google MySQL cloud but I get the following error message:
Error 1142: INSERT command denied to user 'cloudsqlimport'#'127.0.0.1' for table
When I try to grant the privileges to cloudsqlimport from cloud sql console:
mysql> UPDATE `mysql`.`user` SET `insert_priv` = 'Y' WHERE `User` = 'cloudsqlimport';
ERROR 1142 (42000): UPDATE command denied to user 'root'#'104.xxx.xx.xx' for table 'user'
mysql> UPDATE `mysql`.`user` SET `Grant_priv` = 'Y' WHERE `User` = 'root';
ERROR 1142 (42000): UPDATE command denied to user 'root'#'104.xxx.xx.xx' for table 'user'
Same issue when I try to grant the 'insert_priv' through MySQL workbench
How can I resolve this issue?
This error might be due to one of the following causes:
1- Lack of permissions
2- Database or Table spelled wrongly.
3- User correctly spelled but the IP is not correct.
To see the permissions your user has, Please log into MySQL prompt with your user, and run the following command:
SHOW GRANTS;
This will show you the privileges (grants in MySQL) that the current user has. Please check if you have INSERT privileges for the given table.

Mysql: new user access denied to database

I'm using Mysql 5.5. I logged in mysql by root and created a new user.
Then I logged in using
mysql -u newuser -p
Then in mysql I entered
GRANT ALL PRIVILEGES ON db1.tablename TO 'newuser'#'localhost';
in order to access to the databases.
But there is an error message:
ERROR 1142 (42000): SELECT,INSERT,UP command denied to user 'newuser'#'localhost' for table 'tablename'
I even tried other commands such as GRANT CREATE or GRANT DROP, the same error keep showing.
ERROR 1142 (42000): CREATE,GRANT command denied to user 'newuser'#'localhost' for table 'tablename'
Can someone please help?
You logged into MySQL as root and created the new user, but you need to grant the permissions to the new user as well while logged in as root. Then you'll be able to login as newuser and execute statements.

ERROR 1046 (3D000): No database selected while creating user

When I create a admin user with:
GRANT ALL ON * TO my_name#localhost IDENTIFIED BY 'my_passwd' WITH GRANT OPTION
I received the error message "ERROR 1046 (3D000): No database selected".
You should be saying it like below by qualifying it with database name. Check MySQL Documentation for more information.
GRANT ALL ON db_name.*
So for your case,
GRANT ALL ON db1.* TO my_name#localhost IDENTIFIED BY 'my_passwd'
WITH GRANT OPTION;

Privileges issue

I have a mysql database (version 5.5), and I am trying to add a new user.
But I don't have the privileges to create it.If I try to show the list of all users:
select * from mysql.user;
It gives this error:
ERROR 1142 (42000): SELECT command denied to user ''#'localhost' for table 'user
It seems like I am not able to do anything.How to grant the privileges for a user without using the grant command?
There's a way? I also tried this:
CREATE USER 'ramy'#'localhost' IDENTIFIED BY 'pass';
It says:
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
I don't see any way to handle privileges, mysql show have a method to handle privileges for who have newly created a database.That's a vicious circle.
You need to login as the 'root' account
See this if you don't know the root password
http://dev.mysql.com/doc/refman/5.0/en/resetting-permissions.html