Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Wed Jul 03, 2013 9:35 pm 
Offline
Senior Member

Joined: Sun Mar 28, 2010 2:43 pm
Posts: 76
Website: http://tomakefast.com
Location: Texas
Here are my rules:

Code:
[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...

Code:
[root@blah ~]# mysql -u username -ppassword
ERROR 1045 (28000): Access denied for user 'username'@'localhost' (using password: YES)
[root@blah ~]#

_________________
PHP Development @ Tomakefast


Top
   
PostPosted: Wed Jul 03, 2013 9:57 pm 
Offline
Linode Staff

Joined: Tue Apr 02, 2013 3:09 pm
Posts: 23
Website: https://twitter.com/jcurreee
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@<explicit host>.

The MySQL manual has more information on how connections are verified: http://dev.mysql.com/doc/refman/5.7/en/ ... ccess.html


Top
   
PostPosted: Wed Jul 03, 2013 10:01 pm 
Offline
Senior Member

Joined: Sun Mar 28, 2010 2:43 pm
Posts: 76
Website: http://tomakefast.com
Location: Texas
jcurry wrote:
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@<explicit host>.

The MySQL manual has more information on how connections are verified: http://dev.mysql.com/doc/refman/5.7/en/ ... ccess.html


Awesome @jcurry that's exactly what I wanted to "rule" out.

_________________
PHP Development @ Tomakefast


Top
   
PostPosted: Wed Jul 03, 2013 10:04 pm 
Offline
Senior Newbie

Joined: Sat May 14, 2011 5:28 am
Posts: 14
Just to add on to jcurry's post, with some builds of mysql, user@% will allow a connection from all external hosts, but will still refuse localhost. You need to explicitly add a row for localhost too.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group