MySQL set server to run not externally for internet - mysql

I know, that if I want I could run my application ( C++ or .NET ) , which I've developed internally. I mean, I have an external IP for my PC, but for the security reasons I don't want my application to be seen, so for it, I just set NOT an external IP for the part where I'm binding an IP for a socket, that listening. That is the way how I did my application be seen only internally.
But what for the MySQL server? I scanned my server and see, that MySQL 3306 port is seen. I think it's bad. How can I hide MySQL Server from the public and make it ineternally seen?

Related

PHP MyAdmin Azure App Services - (HY000/2002): An attempt was made to access a socket in a way forbidden by its access permissions

When attempting to connect to the Azure App Services (ASP.NET) MySQL database (Navigating to the Manage link) the Page info returned from PHPMyAdmin prevents me from moving forward. I cannot seem to find the location of the log for the app within Kudu and navigating to the MYSQLCONNSTR_*.ini file did not provide me with the information that I needed.
I've attempted to use the connection strings for the database for both the scm and the web app but neither work. I have also attempted to use the public-facing IP within the Kudu environment variable without any luck.
I cannot seem to find the information I need to connect to my instance of PHPMyAdmin, and am now quite lost.
The solution to my problem was here: https://stackoverflow.com/a/57545678/4212591
The free tier of the Azure Web Service does not allow for the always-on feature. Thus my inability to connect to the service.
I’m unsure on the exact location/path you are looking for that file, the connection string is stored at D:\home\data\mysql\MYSQLCONNSTR_localdb.txt.
If you wish to customize the database, username and password, after you have created a new database, add new username or update password, simply modify:
D:\home\data\mysql\MYSQLCONNSTR_localdb.ini , remove D:\home\data\mysql\MYSQLCONNSTR_localdb.txt and restart the WebApps.
Furthermore, the connection string flows to your application as an env variable MYSQLCONNSTR_localdb. The env is added to the main site process. For Kudu site, one may read the same info from D:\home\data\mysql\MYSQLCONNSTR_localdb.txt file. Beware that we are not using the default MySql port (3306). In fact, the port number may vary for each application life cycle depending on its availability at startup time. The port info is also available as an env variable WEBSITE_MYSQL_PORT to your site.
Ensure that MySQL process is running. Check in your web app application settings if there is a connection string. PHPmyadmin uses MYSQLCONNSTR_ to connect to the MySQL server. If you have a connection string in application setting change the connection string type to Custom , so you can still have the information if needed or delete it. This will force PHPmyadmin to access MYSQLCONNSTR_localdb and connect to the MySQL in-app server.
As a side note, on Azure WebApps Sandbox - Connection attempts to local addresses (e.g. localhost, 127.0.0.1) and the machine's own IP will fail, except if another process in the same sandbox has created a listening socket on the destination port.
To rule out, application code or the client library leaking TCP socket handles or burst load of requests opening too many TCP socket connections at once, scale-up Azure App Service Plan and see if that makes any difference.

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.

Can app on GAE(google app engine) access Mysql server host on VPS/dedicated server?

One of my small python web app hosts on GAE
but I prefer to change its database to Mysql.
GAE database is too special which rely on GAE and not good for future migration.
Can python app on GAE(google app engine) access Mysql server host on VPS/dedicated server?
(of course they are not in same local network with GAE)
if sure, what need to care(firewall, port policy and all others) for Mysql server being open to web?
Sure.
Open the single port needed (3306) inside your firewall of choice.
Always install relevant security updates to the mysql server software as soon as possible.
Create a new mysql user for access from your GAE instance.
Possibly restrict access for this user to one single IP inside of mysql.
(If this is true, you can also enforce it in your firewall of choice too, which hardens the access even more.)
Grant this user as less rights as possible inside mysql.

Windows XP localhost as MySQL server alias

I'm on the road at the moment and just had a thought
I have a Windows XP Virtual Machine installed with Delphi and a local MySQL server set up with copies of the "live" databases back in the office.
I'd like to be able to use the local db in place of the "live" one if I'm offline.
At the moment in Delphi I have "local" connections set up, but these are only any use within Delphi. And often lead to issues if I forget to switch back to the live connection when I get back to the office.
Is there any way I can fool Windows into thinking that the local MySQL server is in fact the office server if it can't reach the office server? Can it spoof two server names?
You can edit the hosts file in c:\windows\system32\drivers\etc\hosts which will allow you to make any requests to server.fqdn go to 127.0.0.1
http://kb.simplywebhosting.com/idx/0/045/article/
e.g. a request to servername.domain.tld using MySQL connection strings will redirect to your local DB.
You will still need to remember to change this back when you get to the office...
(If you have delphi on the laptop though, why not create a simple service which edits the hosts file based upon whether the server is reachable or not.)

Accessing MySQL Database from my VB.NET 2008 Project

I developed a project in VB.NET
In this project I want to use data from MySQL that is resides in my WEB Server.
I can communicate with the MySQL server of my localhost but can not communicate with the WEB Server.
In my CPanel I added Host from the Remote Database Access
But I can't communicate with WEB MySQL Server.
Please help me.
The first step is to try to connect to the web mysql with MySql Query Browser - that will tell you if the database is open for remote connections ( I assume it would fail)
I guess you have already checked it, but make sure you use the correct ip
EDIT:
As Björn said, your vb code is ok, so the problem is with the connection to the db.
Unfortunately that would be caused by many many reasons.
Are you sure you use a real IP from the host (and use it in the mysql settings)?
Are you sure you entered the correct remote host in the mysql settigns?
Are you sure you have correct connection string in the vb code?
Since your post indicates you can access the DB on your localhost, it doesn't seem to be an issue with the way you're connecting to the DB from your application (.NET-Connector?).
What does the external MySQL-Server say? Access denied? Or can't you reach it from the pc where your application is hosted (aka maybe a firewall regulation, other network etc.)?