It took me a few minutes to connect remotely to a mysql database. My use for this is to use the same database for multiple installations of web software (moodle). I’ll go into that in-depth later, but right now, let’s just connect to the database from remote. These instructions are based on Ubuntu Gutsy or Feisty, but should be pretty general to any mysql and linux server. These steps are done on the database server.
1. edit /etc/mysql/my.cnf to remove the lock for localhost (127.0.0.1)
sudo nano +47 /etc/mysql/my.cnf
comment out the line (add a # at the VERY beginning of the line)
#bind-address = 127.0.0.1
2. edit /etc/hosts.allow to allow connections from your server (10.0.0.1 in this example - change it to the address you are connecting FROM). Note: “ALL” is too general, but I had trouble using “mysqld”, which was recommended.
sudo nano /etc/hosts.allow
scroll to the bottom and add:
ALL : 10.0.0.55
3. Add the user in mysql with the correct host identification. Enter mysql as root (mysql -u root -p) and do the following:
create user remoteguy@10.0.0.55 identified by 'l33ta0l';
4. You could restart your mysql and inet services, but i just restart the server - sometimes easier
NOW, go to the client (in this case, we’re calling it 10.0.0.55) and do, (we’re calling the mysql server 10.0.0.2) :
mysql -u remoteguy@10.0.0.55 -p -h 10.0.0.2

0 responses so far ↓
There are no comments yet...Kick things off by filling out the form below.
Leave a Comment