[ALUG] mySql - problems with passwords etc., is there no easy way?

simon ransome simon at nosher.net
Mon Nov 24 12:24:00 GMT 2008

Chris G wrote:
> I always seem to get in a tangle with installing and setting up mySql.
> The essential problem seems to be that mySql wants to refer to the
> local machine as 'localhost', and, and 'chris'.  Thus when I
> try and add a user it seems that the user gets added with privileges
> for one (or some) but not all of 'localhost', and, and
> 'chris' and then doesn't work because I need to acces the database as
> one of the other host names.
> Adding a user as 'user'@* seems to be even worse and doesn't work at all.

MySQL host (and strings in queries) wildcards are of the form "%", so 
you would need to add something like:

"Grant all on database.* to 'user'@'%' identified by 'password'";
"Flush privileges" (depending upon version, may not be neccesary now)

You also need to be aware that in the table mysql.user, there are a set 
of top-level access rules - there will generally be several inserted by 
default for 'users'@'localhost'. This can cause some fun as if you grant 
new privileges to user@'%' and then connect locally, this rule can 
appear *after* the default, meaning it is never reached: so either 
delete the row with the localhost host, or overrule with an additional 
grant for 'user'@'localhost' (to which should be an alias, and 
possibly "chris" depending upon how that's resolved). You can see what's 
already there with a "select * from mysql.user;"

Simon Ransome                                       http://nosher.net

Photography RSS feed      -       http://nosher.net/images/images.rss

More information about the main mailing list