Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: Remote access to MySQL
PostPosted: Mon Feb 22, 2010 1:56 pm 
Offline
Newbie

Joined: Sat Feb 20, 2010 7:13 am
Posts: 2
How do i enable remote access to MySQL database server in Linode with Ubuntu 8.* & MySQL 5.* ?


Top
   
 Post subject:
PostPosted: Mon Feb 22, 2010 2:15 pm 
Offline
Newbie

Joined: Mon Feb 22, 2010 11:56 am
Posts: 2
I'll preface by saying I think this is A Bad Idea. Be sure you read through the MySQL reference manual section on Server Administration and that you understand the risks involved prior to doing so!!

Also, look into using SSH for the MySQL connection. At the very least use the '-C' option when connecting from a remote address.

1) Make sure your iptables / firewall is allowing external access to TCP port 3306
2) Make sure your my.cnf [mysqld] section is using TCP (port 3306) instead of / along side a socket file.
3) Make sure your my.cnf is using bind-address to your external address

4) Create a user for an external connection, e.g.
Code:
CREATE USER external@'%' IDENTIFIED BY 'somepassword';


You can also specify a specific domain or IP addr you're connecting from, e.g.
Code:
CREATE USER external@'otherdomain.com' IDENTIFIED BY 'somepassword';


5) Make sure you choke down the GRANT for this user!!
Code:
GRANT SELECT,INSERT,DELETE ON yourdb.* TO external@'%';



I think that's about it. Restart mysqld (/etc/init.d/mysql restart).


Top
   
 Post subject:
PostPosted: Mon Feb 22, 2010 2:56 pm 
Offline
Senior Member
User avatar

Joined: Sun Feb 08, 2004 7:18 pm
Posts: 562
Location: Austin
If I absolutely had to do something like this, I would definitely tunnel port 3306 over SSH, rather than open mysql to the outside world directly.

Just make sure you're bound to 127.0.0.1, and that your connection script retries on disconnect, and that it's part of startup.


Top
   
 Post subject:
PostPosted: Mon Feb 22, 2010 3:02 pm 
Offline
Senior Newbie

Joined: Sun Jan 24, 2010 4:21 pm
Posts: 16
Location: Herning
http://library.linode.com/databases/mys ... ssh-tunnel

Guide from the libary


Top
   
 Post subject:
PostPosted: Thu Feb 25, 2010 11:58 am 
Offline
Senior Member

Joined: Sat Mar 28, 2009 4:23 pm
Posts: 415
Website: http://jedsmith.org/
Location: Out of his depth and job-hopping without a clue about network security fundamentals
Most snazzy clients support SSH to the database server, and leaving MySQL listening on only 127.0.0.1. I know Navicat does.

If you're working with a program that doesn't, an SSH tunnel is the way to go.

_________________
Disclaimer: I am no longer employed by Linode; opinions are my own alone.


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


Who is online

Users browsing this forum: No registered users and 3 guests


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