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

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.

Related

Cannot connect to mySql from a lan network computer

I have a MySql Server 5.7 running as service on one computer of a LAN.
My application is installed and running fine on the same computer. I have 'Shared with everyone' set for the directory where my application is located. In the same directory I have put the libmysql.dll and the FDConnectionDefs.ini files.
My application is running fine on that computer. On the other computers on the LAN I created a link to the directory where my application is shared. When I try to run my application from these LAN systems they produce the error message
[FireDac][Phys][mySql] can't connect to mySql server 127.0.0.1 on port 3306... (10061).
All machines are running Windows 10 on 64 bit processors.
Here what i've tried to resolve the problem:
make sure that the user, password and host (%) are the same in mySql Profile and FDConnectionDefs.ini.
I've tried with different users even with root, i've tried to change host (%) to put the IP address of the computer trying to connect in the mySql profile.
I make sure that i have permissions to run my application and mySql and that the port 3306 is open in the Firewall/Kaspersky on each computer of the LAN. But always the same error message.
127.0.0.1 is a special IP address - the "loopback" address that is typically resolved for localhost on most systems. It is a private internal IP address that a computer can use to refer to itself. It has no meaning to other systems on a LAN since every computer will recognize 127.0.0.1 as meaning itself.
This means that when you are running the application on a remote system it will be trying to connect to a MySQL server running locally rather than on a server elsewhere.
You'll need to configure your FireDac components to connect to the actual LAN IP address that belongs to the system hosting the MySQL server. You will probably also need to make sure that your MySQL users are set up to authenticate from an IP other than localhost.

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.

How to add my IP to cPanel's Remote MySQL Database Host with Delphi?

I coded a program which connects to my web host's MySQL database. I have no problem with it.
But since I do not have a static IP and my IP changes every time I close my modem. I always add my new IP to Cpanel's Remote MySQL Host panel and then I am ready to go and connect to my database.
It is very difficult for me to add my modem ip to Remote MySQL Host manually every time it changes.
Is there a way if I can add my modem IP to Remote MySQL Host panel with Delphi coding?

Localhost database connect from other sysytem

I am testing a website which in other machine like 192.168.0.1 in my machine which is 127.168.0.2 so in the website ajax jquery is used on page load in which the url is
http://localhost/Demo/store.php
but when i execute that page in website in other machine the database isnt connecting and even if i give the url as
http://192.168.0.1/Demo/store.php
its not connecting to database..What is the issue please tell me...How can i access from other system so that all my local database values can be displayed in other machines also..Thanx..
From http://technet.microsoft.com/en-us/library/cc940018.aspx:
address 127 .x.y.z is reserved for loopback testing and interprocess communication on the local computer.
Your probably not connected to your network correctly. Check your physical connection (blinking leds), then make sure you have a DHCP server on the network, otherwise assign a static IP.
After this try pinging the address to make sure the 2 hosts can see each other. Also open up any ports which may be behind a firewall, 3306 is default for MySQL DB.

Heroku Node.js Remote Mysql Database IP Address

I have a remote Mysql database that I am connecting to through Node.js on Heroku. My MySql host (bluehost) wants me to input IP Adresses of all remote MySql connections.
Heroku doesn't have a dedicated IP for my app, so how can I connect to it? Bluehost mentions something about a Class C IP on its page, but I'm not sure Heroku has one...
Also, I believe I already have all of the heroku environment variables set up correctly:
(heroku config:add EXTERNAL_DATABASE_URL=...)
Thanks :D
Here's what blue host says about dynamic ip addresses:
Dynamic IP Addresses
Having a dynamic IP address means that the connecting IP address can
change periodically depending on the Internet Service Provider (ISP).
You must update the connecting IP in Remote MySQL every time it
changes.
from https://my.bluehost.com/cgi/help/89.
So at least each time you redeploy your application, you have a chance to get a different ip address. So this seems highly impractical. Why don't you use Heroku's MySQL offering?
You can use one of 'static ip' addons and proxy connection via that static ip - see this discussion