Access denied for user 'xxx'@'xxx.xxx.xxx.xxx'
I know that there are similar questions, but I didn't find exactly what I'm looking for. Here's what happens and it's kinda strange:
[root@xxx xxx]# mysql -u profuser -ppwd -h 192.168.1.99
ERROR 1045 (28000): Access denied for user 'profuser'@'192.168.1.99' (using password: YES)
And 192.168.1.99
is my own IP. But when I use localhost
or 127.0.0.1
, it's OK:
[root@xxx xxx]# mysql -u profuser -ppwd -h 127.0.0.1
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 68
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql> bye
[root@xxx xxx]# mysql -u profuser -ppwd -h localhost
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 69
Server version: 5.0.45 Source distribution
Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
mysql>
I found this question, but it didn't help:
mysql> select host from user where user='profuser';
+--------------+
| host |
+--------------+
| 127.0.0.1 |
| 192.168.1.99 |
| localhost |
+--------------+
I added my IP, as advised in the other question.
Does the password hash match for the new user/host combo? Tweak your select statement: select host, password from user where user='profuser';
Anyway, what're you attempting to achieve? You're adding the -h 192.168.1.99
flag; this isn't necessary when connecting locally (as you've discovered). If you're going to want to connect over the network, then you'll need a user spec like 'root'@'192.168.1.%'
or 'root'@'%'
, something to allow remote hosts; if you're just doing local connections then you don't need the -h
.