0

root@127.0.0.1 exists, but still can't connect to local MySQL. It looks like MySQL verifies hostname instead of lo ip(127.0.0.1).

root@castle /v/l/mysql# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.6.22 MySQL Community Server (GPL)

Copyright (c) 2000, 2014, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> use mysql;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed
mysql> select user, host from user where user='root';
+------+-----------+
| user | host      |
+------+-----------+
| root | 127.0.0.1 |
| root | ::1       |
| root | castle    |
| root | localhost |
+------+-----------+
4 rows in set (0.00 sec)

mysql> exit;
Bye
root@castle /v/l/mysql# mysql -u root -h 127.0.0.1
ERROR 1045 (28000): Access denied for user 'root'@'lixxx-yyy.members.linode.com' (using password: NO)
user805627
  • 103
  • 3

1 Answers1

0

Where is it getting "lixxx-yyy.members.linode.com" from? Check you /etc/hosts file.

Try:

host 127.0.0.1

Expect to see:

1.0.0.127.in-addr.arpa domain name pointer localhost.                                                     

You can add that host to the hosts table to allow root to connect, or try to have "127.0.0.1" resolve to "localhost" as expected.

Dan Armstrong
  • 821
  • 4
  • 6
  • Yes, when I run `host 127.0.0.1`, I get '1.0.0.127.in-addr.arpa domain name pointer localhost. ' The problem is MySQL check my eth0 ip instead of lo ip. – user805627 Jan 30 '15 at 14:56
  • `host 106.186.xxx.yyy`(eth0 ip): yyy.xxx.186.106.in-addr.arpa domain name pointer lixxx-yyy.members.linode.com. `host 127.0.0.1`: 1.0.0.127.in-addr.arpa domain name pointer localhost. – user805627 Jan 30 '15 at 15:00