I am running mysql Ver 12.20 Distrib 4.0.13, for pc-linux (i686) on RedHat
6.2 (so shoot me, I'm using an old scratch computer so I won't break
anything on the real development machine)
I tried to create a user by inserting directly into mysql.user. When I set
user.host to localhost, it works, when I set it to % it doesn't. I thought
% matched anything, and so should match localhost. In case I've missed
something in the docs, please direct me to the correct page.
I ran this, and it worked
----------------------------------
mysql -u root mysql << EOF
delete from user where user = 'foo';
insert into user (host, user, password) values('localhost', 'foo',
password('bar'));
flush privileges;
EOF
mysql -u foo -pbar << EOF
quit
EOF
----------------------------------
So then I tried the same thing, just changing localhost to %, and the
second mysql, where I try to log in as user foo, password bar (I know it's
unsafe to put the password on the command line, this is just for testing)
says
ERROR 1045: Access denied for user: '[EMAIL PROTECTED]' (Using password: YES)
----------------------------------
mysql -u root mysql << EOF
delete from user where user = 'foo';
insert into user (host, user, password) values('%', 'foo', password('bar'));
flush privileges;
EOF
mysql -u foo -pbar << EOF
quit
EOF
----------------------------------
So I tried adding this line to after the insert
select host, user, password from user where user = 'foo';
in case maybe I had botched the insert, or there were other entries in the
user table that messed things up. Here's what I got (looks OK to me):
host user password
localhost foo 7c9e0a41222752fa
host user password
% foo 7c9e0a41222752fa