Having trouble adding localhost to iptables
[root@blah ~]# iptables -L INPUT --line-numbers
Chain INPUT (policy ACCEPT)
num target prot opt source destination
1 ACCEPT tcp -- localhost anywhere tcp dpt:mysql
2 ACCEPT tcp -- blah.members.linode.com anywhere tcp dpt:mysql
3 ACCEPT tcp -- blah.net anywhere tcp dpt:mysql
4 DROP tcp -- anywhere anywhere tcp dpt:mysql
[root@blah ~]#
I can access mysql from home (blah.net) and from my other Linode (blah.members…) with "mysql -u username -ppassword -hx.x.x.x"
But localhost doesn't work…
[root@blah ~]# mysql -u username -ppassword
ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)
[root@blah ~]#
3 Replies
In order to log in as user@localhost, you need to add a row and the appropriate privileges to the mysql.user table as user@localhost, or modify your existing account to user@% (% meaning all hosts) instead of user@
The MySQL manual has more information on how connections are verified:
@jcurry:
This is not a result of the connection being blocked by iptables, but rather an authentication failure from MySQL.
In order to log in as user@localhost, you need to add a row and the appropriate privileges to the mysql.user table as user@localhost, or modify your existing account to user@% (% meaning all hosts) instead of user@
. The MySQL manual has more information on how connections are verified:
http://dev.mysql.com/doc/refman/5.7/en/ … ccess.html">http://dev.mysql.com/doc/refman/5.7/en/connection-access.html
Awesome @jcurry that's exactly what I wanted to "rule" out.