nerdenator
nerdenator

Reputation: 1307

Granting privileges on MySQL

I have a MySQL database that I'm using for testing of a C# application. As a superuser, I enter the following 'query':

GRANT ALL PRIVILEGES ON testing.* TO 'Ubuntu'@'localhost';

to an affirmative message. Then, I log out of the database, log back in as Ubuntu, and run the following query on a localhost connection:

USE testing;

and receive this message:

ERROR 1044(42000): Access denied for user 'ubuntu'@'localhost' to database 'testing'

I've also run this query:

GRANT ALL PRIVILEGES ON testing.* TO 'Ubuntu'@'%'; 

with the same result.

What exactly am I missing? It seems like a fairly straightforward procedure...

Upvotes: 0

Views: 182

Answers (2)

AMADANON Inc.
AMADANON Inc.

Reputation: 5929

You need to flush the privileges:

FLUSH PRIVILEGES;

As Ricky pointed out (what is this, the mutual admiration society?!) usernames are case-sensitive, so the user Ubuntu is different from the user ubuntu

Upvotes: 2

Ricky Mutschlechner
Ricky Mutschlechner

Reputation: 4409

I believe usernames are case-sensitive. In your queries, I see that you are granting permissions to "Ubuntu" which is uppercase, but in your error message, "ubuntu" is lowercase.

Also, as pointed out by AMADANON Inc., you will most likely need to run the query

FLUSH PRIVILEGES;

in order for the permissions to actually kick in.

Upvotes: 1

Related Questions