mysql: access denied on information_schema - mysql

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.

Related

Mysql Mariadb user not able to access DB

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'#'%';

Mysql workbench Error 1044 / 1142: Access / Grant command denied to user ''#'localhost' for

I work on a Mac OSX 10.6.8, and I use Mysql Workbench to learn how to handle databases (I'm a beginner as far as databases go). Now, I have created a few users, and I'm trying to toy around with giving these users' rights, and let them interact with each other by granting and revoking each other various rights.
I have logged in via the root user and supposedly given all "toy users" their initial rights by using the necessary grant queries (verified via queries using "show grants"), but then I try to log in as the various users. Let's say two of these users are named "Sofia" and "Martin", and I want Sofia to give Martin the update- and insert-rights to a table "Book". Sofia was given the necessary privileges from my root-login unless I am mistaken, so I write (when logged in as Sofia)
grant update, insert on Book to Martin;
This yields the error
Error 1142: GRANT command denied to user ''#'localhost' for table
'book'
Further, I try to figure out what rights Sofia does have, and enter the following query
show grants for Sofia;
when logged in as Sofia. The response:
Error 1044: Access denied to user ''#'localhost' for database 'mysql'
What is this mysterious ''#'localhost' user the errors are talking about? What should I do to make things work?
grant update, insert on Book.* to `Martin`#`%`;
please click edit to see the back-ticks
See the MySQL manual page on SHOW GRANTS

MySQL connection with DBVisualizer

I've created a user (1caap) in mysql root account and given read only privileges for this user to one of my database. Now my client(1caapuser) is unable to access this database. I've established the connection using Workbench. He's getting the following error when he's trying to access this database using DBVisualizer:
An error occurred while establishing the connection:
Type: java.sql.SQLException Error Code: 1045 SQL State: 28000
Message:
Access denied for user '1caapuser'#'x.x.x.x' (using password: YES)
Please help me out if i'd missed any settings at the earliest.
To resolve this issue you have to grant all privileges on database with identified by the password
Command to run:
GRANT ALL PRIVILEGES ON yourDBname.* TO username#'%' IDENTIFIED BY 'password';
Check the following for more details about the error you get:
http://dev.mysql.com/doc/refman/5.1/en/access-denied.html
https://dev.mysql.com/doc/refman/8.0/en/error-access-denied.html
You must most likely grant proper access for the user at the given IP address/host name. Such as:
grant on . to ''#'';
Check the users guide which specific privileges and what target objects to grant. The important clause above is that you need to specify 'user'#'ip-address'.
Again, check the users guide as there may be a collection of reasons for the error you get.

How to get dump of database if I only have select privileges on it

How to get dump of database if I only have select privileges on it. It is giving access denied error when I am running mysqldump command.
I am getting following error:
mysqldump: Got error: 1044: Access denied for user 'sangeeta'#'%' to database 'abc' when doing LOCK TABLES
Thanks!!
Two options:
You really get an access denied error. Error message is clear, you don't have select privileges.
You get a message that you don't have the privilege to lock the tables.
Solutions for number 2:
Use the --lock-tables=false option for non-InnoDB tables or the --single-transaction option for InnoDB tables.

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