Why doesn't mySQL allow [email protected]'%' from localhost?

Talik asked:

It seems that the solution to accepting users from localhost is to create a copy of the user with @’localhost’ (in addition to [email protected]’%’). I’m trying very hard to understand the logic here, because it seems kind of bat-nuts crazy that the ‘any host’ wildcard, ‘%’, wouldn’t also accept localhost connections. Creating a second user isn’t very practical when dealing with a large number of users. If a user changes their own password, it would then leave the other one unaffected.

Is there any sort of workaround to allowing [email protected]’%’ to accept localhost connections?

My answer:

You need to remove the anonymous users, as MySQL’s pattern matching will match them first.

Run the mysql_secure_installation script or remove them manually.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.