JBT
JBT

Reputation: 8756

Grant access from any host (remote or local)

I tried something like below on localhost to grant access from any host:

grant all on tos_db.* to 'tos'@'%' identified by 'tos';

However, when I tried the following command on localhost, it didn't work:

$ mysql -u tos -p
Enter password:
ERROR 1045 (28000): Access denied for user 'tos'@'localhost' (using password: YES)

Then I replaced the % symbol with localhost in the grant statement. Unsurprisingly, it worked. But I am confused. Isn't the % symbol supposed to match any host? Or is it just for remote host?

Upvotes: 0

Views: 54

Answers (1)

user3522371
user3522371

Reputation:

You get that error because the wildcard % does not cover socket communications which thing the localhost is for.

Upvotes: 1

Related Questions