Solved

Enable MySQL Remote Connections

Posted on 2011-03-08
3
584 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 83

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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

All XML, All the Time; More Fun MySQL Tidbits – Dynamically Generate XML via Stored Procedure in MySQL Extensible Markup Language (XML) and database systems, a marriage we are seeing more and more of.  So the topics of parsing and manipulating XM…
This guide whil teach how to setup live replication (database mirroring) on 2 servers for backup or other purposes. In our example situation we have this network schema (see atachment). We need to replicate EVERY executed SQL query on server 1 to…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

785 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