[CentOS] mysql can't connect from localhost -strange behavior

Mon Mar 30 08:41:51 UTC 2015
Paul Jones <paul.jones at atass-sports.co.uk>

On 30/03/15 05:22, Tim Dunphy wrote:


mysql> FLUSH PRIVILEGES;




Yup! That was it. Thanks for the reminder! :)

Tim


>From the mySQL man pages:

If you modify the grant tables indirectly using account-management statements such as GRANT<https://dev.mysql.com/doc/refman/5.5/en/grant.html>, REVOKE<https://dev.mysql.com/doc/refman/5.5/en/revoke.html>, SET PASSWORD<https://dev.mysql.com/doc/refman/5.5/en/set-password.html>, or RENAME USER<https://dev.mysql.com/doc/refman/5.5/en/rename-user.html>, the server notices these changes and loads the grant tables into memory again immediately.

So I'm confused as to why FLUSH PRIVILEGES is necessary, because this suggests the GRANT command is doing a flush anyway.

I ask because I get this behaviour occasionally with adding mySQL users/permissions too, and I hate blithely running a command 'because it works' if it's not actually the correct thing to do (though admittedly it does work).

Because we're creating a user as well as assigning permissions maybe? So a GRANT to an existing user wouldn't require the FLUSH PRIVILEGES?

Appreciate this is a mySQL rather than CentOS question, but it bugs me on CentOS machines, so that's something!

Paul

--