Solved

Enable MySQL Remote Connections

Posted on 2011-03-08
3
564 Views
Last Modified: 2012-05-11
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
Comment
Question by:frontpedal
3 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 35067831
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
 
LVL 4

Assisted Solution

by:gizmola
gizmola earned 250 total points
ID: 35074193
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
 

Author Comment

by:frontpedal
ID: 35083691
Thanks guys both pieces of advice proved very useful.  
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

More Fun with XML and MySQL – Parsing Delimited String with a Single SQL Statement Are you ready for another of my SQL tidbits?  Hopefully so, as in this adventure, I will be covering a topic that comes up a lot which is parsing a comma (or other…
Both Easy and Powerful How easy is PHP? http://lmgtfy.com?q=how+easy+is+php (http://lmgtfy.com?q=how+easy+is+php)  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now