Tuesday, February 25, 2014

MySQL Server Remote Access

So, with any project with multiple computers involved, you will likely have to set up remote access rules for certain programs. In our case, we had to set up MySQL to accept connections from the outside. And not only that but allow any remote host to connect as we already know that the IP's of our client nodes (The Raspberry PI's) will change from time to time. To achieve this, we had to make two changes. I used the following site as a reference:

http://www.cyberciti.biz/tips/how-do-i-enable-remote-access-to-mysql-database-server.html

For the most part, everything worked except for one thing: When the tutorial gets to the command to save the new iptables firewall rule, the command from the site above didn't work for me. I used the following link to find the proper command to save my new iptables rule.

https://help.ubuntu.com/community/IptablesHowTo

and for the people who feel that article is too long, that command is:

 iptables-save

Again, make sure you have root access when you use this command either with sudo or sudo su.
Finally,  reboot your computer and you can connect to your MySQL database from any remote computer by using:

  mysql -u username -h ip_address -p

where username is your actual username to your database and ip_address is the address of the server you had to ssh into. The host of your MySQL database.
From here, we were able to connect to our MySQL database from our own laptops and Karl was even able to run a Django test from his laptop and it automatically populated our database.

No comments:

Post a Comment