In this post I want to bring you how to create a server using dynamic IP and the server is in a network controled by a router.
1- Let’s start by installing MySQL server in the machine
- Download MySQL from this link http://dev.mysql.com/downloads/mysql/5.1.html#winx64.
- Run the installer
- Use the custom installation and choose C:MySQL directory to install
- Leave all setting as default and click “Execute” on the last installation screen. All the items should be checked in green.
2 – Now we`ll configure our DNS to point to a Dynamic IP.
- First we need to create an account on www.no-ip.com. Create a free account and go to the control panel.
- Click on ‘Add a Host’. Choose your host name and option ‘DNS Host (A)’ should be selected. There’s no need to change the other settings and then click on ‘Revert’.
- Now you created your DNS and we need to make it point to your machine so still on no-ip.com, go to ‘Download Client’ on the left side of the screen and select your operating system.
- When download is finished run the installer a new icon will appear on the system tray stating NO-IP DUC is running and your router’s IP beside.
- Double click on the icon a screen will show up with the last IP scan update and your host and groups. Since we have created only a host you should see it under the host area on DUC’s screen. To make it available just check your DNS’s box.
3 – Configuring the router to forward the access straight to the MySQL server.
- Since we have created the DNS and installed DUC on the MySQL server we should configure the router to forward the DNS created to the server so we need to access the router configuration through the server’s browser.
- Type the IP address. It usually is 192.168.0.1. Type the user name and password.
- For this tutorial we are woking with a D-Link DI-624 router. Since you opened the router administration area click on the “Advanced” tab.
- Now the select “Virtual Server”. Fill out the form as follows:
-> Name (Choose a name for your virtual server);
-> Private IP (The machine IP where there router should forward the access);
-> Protocol Type (Choose TCP);
-> Private Port (The port router should youse within the network);
-> Public Porter (The port the router is receiving the external access, use port 3306);
-> Schedule (When this port forwarding is enabled, we should select “always”).
- Make sure to check the “enabled” radio box and then apply. The router will save the new virtual server and when the browser is refreshed you should see the new virtual server appearing on the list at the bottom of the page and selected.
4 – Creating a MySQL user enabled to access the server remotely.
- You need a user on MySQL to connect the database remotely so connect as root in the database through the command window and use the following command below to create the user.
mysql create user ‘username’@'%’ identified by ‘password’;
The server configuration is done and you should be able to access your server from another computer remotely. To perform a test, install MySQL client in a different machine and on the command window type the following command.
mysql -hdnsname -uusername -p after click enter the password will be required, type it and now you are accessing your database remotely!
Congratulations!
