How to Access Local MySQL Database Remotely without a Public IP - mysql

i would like to know if there is a way of accessing a local MySQL Database remotely without a public IP Address.
I've a local mysql database called "Books", it is running on a local PC here with Internet Access... I'll travel for some days and i wanted to still have access to that database through Internet, but i don't have a public IP address.
I can't simply clone the database to my laptop, because there are some applications that are using this Database on my local network and i've to maintain its consistency.
is there any way or tool that can help accomplish this?

I would recommend a VPN in combination with a dynamic DNS service. If you have a Internet connection, then you have a public IP - but it may need to be port-forwarded appropriately (firewall, router, etc.).

Related

Is there a way to have AWS RDS Public Accessibility = No but still accessible outside of EC2 instance?

For management-related reasons, I need the Public Accessibility option set to "No" for the RDS.
However, we're also looking into being able to access the RDS from our local devices. The only way we're able to do so is by selecting "Yes" in Public Accessibility. Of course, the VPC, Gateway, Subnet, and Security Groups are already set with the appropriate public-facing stuff, which is probably why the Yes option is working.
But the moment we set it to No, only the EC2 instances are now able to connect to the database.
Is there a way around this or is that really what the Public Accessibility flag does by design?
Thanks in advance.
Setting Public Accessibility to "No" will not allow any access from the internet. There are plenty of ways to connect your RDS to your local.
Add your public IP in the security group of your rds database instance
Jump Server / Bastion
VPN / Direct Connect
Your asking for the best approach on how to secure this.. The best option is #3.
But to do this, you will need to build your database instance in the private subnet.
How?
Navigate to RDS > Subnet Groups.
Create a DB Subnet Group.
Select your VPC and the private subnet to use.
Yes Public Accessibility flag prevent you from accessing the RDS directly through Internet, but you can indirectly access through a jumpserver(like ssh bashtion) which is placed in public subnet. Most of the popular Mysql UI editors like sequel pro has a in build option for ssh config, using this option you can access RDS from local devices. you can also configure tunneling to bastion.
As #user11389395 mentioned, you must have Public Accessibility set to "Yes" in the RDS "Modify" page (this won't cause any outage of your database, or cause it to go down).
Once you have enabled it, you must jump into the Security Group that your RDS server is on, add an Inbound rule with the TCP Protocol, port 3306 (if using MySQL), and then in the Source dropdown, select "My IP":
When you select "My IP", you should see the source input field gray out and display your public IP address. You can confirm this public IP address by checking it online through Google. This grants only your public IP address access to your RDS database through the internet.
Once you save the rule, you should then be able to connect using TablePlus (or another SQL client) from your local computer by entering your RDS "Endpoint" (shown on the RDS "Connectivity and Security" tab) as the hostname, and your master username and password.

Is it mandatory that a mysql server have a static IP address? (client is on same local machine)

I am using a software - (Ingress) by FingerTec which uses mysql database.
Some setups of this system are only using a single installation - consisting of a mysql server and a client locally on the same machine.
I have been having issues since I started to use the software when it is installed on a user's laptop/PC. The problem is that frequently when running the mysql server and client, a window pops up asking for the local IP address and port (127.0.0.1 and 3306 by default). To continue using the software, one needs to run IngressDB installer where you need to 'Update Connection' by giving the root user and pass for mysql and then 'Upgrade Database' to refresh the database for any new settings. After this step the software runs fine.
Yesterday I managed to simulate this issue by changing the static IP on my laptop while connected directly to one of their Access Controllers. I had to re-Run Ingress DBinstaller.
Now my question is this:
When using your machine(laptop/pc) it is normally getting IP add, def GW, Subnet etc from a dhcp server therefore there is no guarantee that you will always get the same IP leased unless there is a reservation to the machine's mac address.
As described earlier - when ever there is a change of IP address leased from DHCP, a window pops up showing the loopback address 127.0.0.1 and the mysql port 3306. So it never shows the local IP address (ex. 192.168.1.100). So I was thinking - why is the loopback IP not enough for mysql client/server as this stays the same forever.
Is is normal that software using mysql database server requires a static local IP on the machine hosting it? I am referring only to instances where both mysql server and client reside on the same machine.
I appreciate your thoughts about this and maybe any other way I can get around this apart from making an IP address reservation in the DHCP server. Setting a static IP address manually on the LAN adapter is no solution for me as this would limit the machine to connect only to a certain network and cannot be used at other places.
If the client is the same local machine as the server, the MYSQL server specifically does not need a static IP because it pretty much already has one: 'localhost' or '127.0.0.1'. If the client is not on the same machine as the server, the server would need a static IP.
If the machine is acting as a server for other content, yes, it would need a static IP. If you're doing this at home, chances are that your access point will let you configure it for a static IP.

Load Balancer + Autoscaling + Mysql on EC2

We have an EC2 instance which is a website, which uses a mysql database which is on another EC2 instance in the same region. In mysql, we have provided restricted access based on server elastic IP to prevent intrusion.
Now, we have decided to install ELB on this server. The ELB part actually works fine, but when auto-scaling spins up a new instance, it has a random public IP address, hence cannot be added to mysql's exceptions.
I tried adding ELB dns(A Name) to mysql for providing access, but it is still not working. The ELB works, Auto scaling spins up a new instance, but the website shows error due to not-connected to database.
How can I correct this?
Rather than restricting access via IP addresses, use Security Groups:
Create a security group (eg App-SG) and associate it with any instance that is permitted to communicate with the MySQL server
Create a security group for the MySQL instance (eg call it SQL-SG) and permit Inbound connections from App-SG
This way, only machines with the App-SG will be allowed to communicate with the MySQL instance. When Auto Scaling launches new instances that are associated with the App-SG, they will also be able to communicate with MySQL.
You should avoid hard-coded IP addresses as much as possible (as in... never use them!).
Instead of restriciting your database access by IP, consider restricting by subnet.
You will have a public subent (webserver and ELB are there) and a private one (database server is there)
Computers in a public subnet is accessible to everyone in internet, computers in a private subnet is available to only computers in a public subnet.
More information about such configuration is here:
http://docs.aws.amazon.com/AmazonVPC/latest/UserGuide/VPC_Scenario2.html
In order to manage your database server, you can setup a bastion host:
http://blogs.aws.amazon.com/security/post/Tx2ZWDW1QA6D62Y/Controlling-Network-Access-to-EC2-Instances-Using-a-Bastion-Server

Using an mySQL Database from another network

I created a mySQL database on one machine in my local network. Lets say, I install my application on a friends computer at his house. I have a computer set up as a server running the mySQL database at my house. If that computer is running, how can I make my friends computer send and receive data from the mySQL database on my network?
I am using JDBC and the J connector. I currently can connect to the database with JDBC, so I am currently good with that.
How can I make my friends computer send and receive data from the mySQL database on my network? Will I need a service like Google Cloud SQL or is there any other free way?I also want to make it so that I can email any friend with the program, and they can install it and the program connects to the MySQL server without Andy router extensional. Is a MySQL database even the way to go?
Edit: Basically, I made an MySQL database on a local computer and am able to save data to it from a JDBC program. I want the SQL database to be online so if I send the program to somebody else, they can open it and it accesses the online database. How should I go about making an online SQL database which has no limitations on what IP address accesses it?
Assuming you have a NAT router connecting your local network to the Internet, set up port forwarding on your router to forward port 3306 to the database machine on your network.
Then your friend would specify your router's public IP as the hostname when making the database connection.
In your MySQL configuration, you'll need to create a user username#your-friend's-IP, and grant it access to your your database tables.
A MySQL client (the thing running on your friend's local network) initiates a connection to a MySQL server by requesting a TCP connection on port 3306 (usually).
So your friend's computer has to be able to initiate a connection to your computer. Most home networks have routers between them and the internet service provided. Routers, unless specially configured, ignore attempts to connect from the public internet.
You need to configure your router to pass port 3306 connections through to your computer. Then you need to figure out the ip address by which your internet service provider addresses your router and your friend's router (usually the router user interface will tell you this). Then you need to set up a username / ip address / password triple on your MySQL database authorizing your friend to connect.
Finally, keep in mind that your internet service provider probably assigns both of you dynamic ip addresses; they might change.

Mysql server from remote computer

how to expose MySql server that run in a production server (with internet connection) so that I can connect from an external computer of data center to the corporate network?
And how can modify the connection string in my WinForm Application?
thanks in advance
Making your database externally available is really an exercise for the DBA, or if that's you a question for https://dba.stackexchange.com/ or perhaps https://serverfault.com/
That being said, your connection string is really the same - you just point to the externally accessible IP address.
I had a similar problem. My domain host has a setup that allows to expose that server. All I had to do is "check" that box (stating I like to use external connection for MySQL). Doing so will give me an IP Address (and other connection params) that I can use to make my connection to MySQL. Check your host.