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
Related
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.
I created a schema and granted its permission to a specific user:
GRANT ALL PRIVILEGES ON USED_CARS.* TO ANDREW#LOCALHOST;
The database is created with root user and then granted these permissions to another user. now when I swith to another account I can list the schema with SHOW SCHEMAS; query however cannot switch to that DB with use USED_CARS; query.
Following error pops up:
ERROR 1044 (42000): Access denied for user 'ANDREW'#'localhost' to database 'USED_CARS'
What am I missing here? Thanks for the help in advance.
Sometimes depending on the configuration of server, you can use localhost or the ip:127.0.0.1
Could you try with this ...
GRANT ALL PRIVILEGES ON USED_CARS.* TO 'ANDREW'#'%';
I try to change a ddev database password for a single project.
I need to check sign-escaping for a project, because I want to know how and if that works.
How can I change a database password in a single ddev-project?
I use
Docker 3.5.1 (66090)
ddev 1.17.2
macOS Catalina 10.15.7
I got answers in slack, thanks for that, but I run into those errors, if I do so:
ddev mysql
MariaDB [db]> GRANT ALL PRIVILEGES ON *.* TO 'db'#'%';
ERROR 1045 (28000): Access denied for user 'db'#'localhost' (using password: YES)
MariaDB [db]> ALTER USER 'db'#'localhost' IDENTIFIED BY 'test/test:test#test?test#test&test"';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
MariaDB [db]> ALTER USER 'db'#'db' IDENTIFIED BY 'test/test:test#test?test#test&test"';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation
I have been trying to drop some of my views in my google cloud database
I ran into this error:
ERROR 1227 (42000) at line 74225: Access denied; you need (at least one of) the SYSTEM_USER privilege(s) for this operation
Based on this document: https://www.labnol.org/code/revoke-grant-permissions-mysql
I ran this query SHOW GRANTS FOR root and I got
'GRANT USAGE ON *.* TO `root`#`%`'
'GRANT `cloudsqlsuperuser`#`%` TO `root`#`%`'
I tried to revoke privileges with this command REVOKE ALL PRIVILEGES, GRANT OPTION FROM root but again I ran into another error 'Error Code: 1269. Can't revoke all privileges for one or more of the requested users'
Is there any solution for how can I grant the user privileges in order to drop tables?
Did I miss something in these commands?
Could you please confirm if you altered the users on that instance before?
Also, could you try to do this on a fresh instance, to see if you get the same behavior.
Create a totally new, fresh database instance with v5.7.
Connect to the database as root#%.
Run the Insert/Delete/Drop query and see.
When i'm create new user or grant privileges to existing, i got this error:
ERROR 1045 (28000): Access denied for user 'root'#'localhost' (using password: YES)
Grant privileges ok on all tables, except information_schema, on this table i got access denied error.
How i can fix? Dump all databases, drop all databases, and then restore from dump?
The MySQL documentation says:
... you can only read the contents of tables, not perform INSERT, UPDATE, or DELETE operations on them.
It is not necessary to grant access to these tables. All users already have access.
"Each MySQL user has the right to access these tables, but can see only the rows in the tables that correspond to objects for which the user has the proper access privileges. In some cases (for example, the ROUTINE_DEFINITION column in the INFORMATION_SCHEMA.ROUTINES table), users who have insufficient privileges will see NULL."
https://bugs.mysql.com/bug.php?id=45430
http://dev.mysql.com/doc/refman/5.1/en/information-schema.html
Note that if you have a typo in the name information_schema, you would also get an denied to user message. This is confusing sometimes.
select * from bogusSchema.bogusTable;
The error would be
Error Code: 1142. SELECT command denied to user 'user123'#'localhost' for table 'bogusTable'
I am using an InfoBright variant of MySQL. Not sure if this same problem exists with other variants/versions of MySQL.