• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 624
  • Last Modified:

Enable MySQL Remote Connections

Hi, How do I enable remote connections on MySQL 5.  Id like the server to accept all connections on the local subnet 10.190.0.1/24  and remote connections made to an ip address, lets say its 86.17.66.238.

Thank you.
 
0
frontpedal
Asked:
frontpedal
2 Solutions
 
Dave BaldwinFixer of ProblemsCommented:
MySQL connections are based on the users.  Each user can be 'localhost', anyhost '%', or a specific host.  If you want remote access, the most common way to copy the username and password for the localhost user into an anyhost user.  http://dev.mysql.com/doc/refman/5.1/en/adding-users.html  If you are using phpmyadmin, it makes it very easy to create new users with different connections.
0
 
gizmolaCommented:
You can use use the GRANT option to add network access grants for existing users.   Just specify the grant for whatever databases, along with the new network ie.  someone'@'86.17.66.238.  You can also use the wildcard as DaveBaldwin indicated.

However, there is also a couple of mysql server configuration items that could be effecting things.  First you have to check that skip-networking is not set.  For 5.1 I don't think that's a default anymore, although for years it was turned on, and would basically disable the entire network layer, only allowing connections through the socket on the same machine.

Now the my.cnf often comes with the bind-address set to 127.0.0.1.  If you are happy just to listen for connections on all the nics in the machine, then you would change that to 0.0.0.0 and restart mysql.

So you basically have a 2 step process...getting mysql to listen on a nic that can talk to the network, and then the individual perms for a user.  If you want an added layer of protection, I'd suggest using a firewall rule on the server, that blocks connections to the nic/port combo that matches your external rule.  This is more efficient than waiting on mysql to lookup the user and determine whether or not they should have access from a particular ip or ip range.
0
 
frontpedalAuthor Commented:
Thanks guys both pieces of advice proved very useful.  
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now