Page 1 of 2 12 LastLast
Results 1 to 40 of 54

Thread: Unable to Access MySQL Remotely

  1. #1

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Unable to Access MySQL Remotely

    I've opened a Stack Overflow thread here: https://stackoverflow.com/questions/...mysql-remotely but I'm asking again here. I really need help figuring this out to finish deployment.

    I am using Windows Server 2016 attempting to host a PHP website via IIS that uses MySQL as the database and separately has a standalone desktop application written in VB.NET (.NET framework 4.7.2) that should also communicate with the MySQL database.

    I was able to setup the website and I can hit it properly on an external network by navigating to https://mywebsite.com:8443/. I'm able to use my website which runs the PHP scripts which they in turn leverage the MySQL database on localhost:3306.

    The issue comes when I attempt to access the database via the desktop application on an external network. If I connect to the machine via a VPN, setup my connection string so that the datasource is pointing to the internal IP address at port 3306, then I connect just fine. However, if I disconnect from my VPN, change the connection string so that the datasource is pointing to my public IP address, it fails to connect. What what it's worth, this is what the connection string looks like (the only thing changing is the datasource:
    Code:
    datasource=-public ip-;port=3306;username=dotnet;password=-password-;database=test;
    The specific error I'm getting is:
    Unable to connect to any of the specified MySQL hosts.
    If I change my port from 3306 to 8443 (which I don't think is right but I'm prepending it for my PHP website), I get a different error:
    Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
    I went down a rabbit hole and found that root did not allow for external request by default, which is why I created the dotnet user. From MySQL Workbench, these are the configurations for that user:
    • Authentication Type: Standard
    • Limit to Hosts Matching: %


    I then read that the SQL server has a bind-address set to 127.0.0.1 by default, so I changed it to accept everything and verified by running:
    Code:
    mysqld --verbose --help
    Scrolling until I found bind-address and the value it prints is *.

    Finally, I read that I need to ensure that the firewall is setup properly. I go to Windows Firewall with Advanced Security, and see that a rule for port 3306 exists with the following properties:
    • Protocol type: TCP
    • Protocol number: 6 (disabled)
    • Local port: Specific Ports 3306
    • Remote Port: All Ports


    At this point, I don't understand why it is connecting fine when VPNed to the machine, but fails when I try to connect from an external network.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  2. #2
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Unable to Access MySQL Remotely

    You need port forwarding on the router to which your server is connected. It is very rare to see win server directly connected to internet so opening port in firewall will allow direct connections. So you have the port 3306 opened on the server, MySQL user set to allow access from other IPs. Forward port on the router that is connected to the internet to the server - e.g. external port 45678 to forward to internal server IP 192.168.0.123 port 3306.

    When you are connected via VPN you are like being connected to the internal network so the server where MySQL runs allows you to connect. That's the idea behind VPN - access private network internal services when you are not directly connected (cable, wifi) to that network. Also, from security point of view, there is no need to expose publicly (accessible for the whole internet with all good and bad people) some services like MySQL.

  3. #3

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    I'm not a networking or IT guy by any means. Could you elaborate on what you mean by this:
    Quote Originally Posted by peterst View Post
    ... Forward port on the router that is connected to the internet to the server - e.g. external port 45678 to forward to internal server IP 192.168.0.123 port 3306. ...
    How do I know which port is connected to the internet?
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  4. #4
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    You stated in your opening post that you can connect just fine via VPN. Why do you think you need this? It is very much a bad idea to expose the database publicly in this fashion.

  5. #5

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    I have a customer who will be on a vessel in the middle of the Gulf of Mexico where internet access is spotty at best. My desktop application stores database operations in a queue until there is internet connectivity, at which point it runs the queries until it loses internet again.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  6. #6
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by dday9 View Post
    I'm not a networking or IT guy by any means. Could you elaborate on what you mean by this:


    How do I know which port is connected to the internet?

    It is job of the network admin to setup port forwarding and to give you these details. Usually firewall is set to block all incoming traffic except ICMP echo request (PINGs) and only the forwarded ports from local network servers to public.

    I will try to give very simplified example with web hosting service. There are several servers behind the firewall. To split the load each server has dedicated job: VPN server, web server, SQL server, FTP server, e-mail server, etc. Each server has own local IP address and its firewall will have some ports opened - for web 80 and 443, for FTP 21 and PASV port range, MySQL 3306 and so on. The admin will forward (firewall will redirect requests coming from internet) few ports - mainly VPN ports, e-mail and web - for each service the destination IP will be the local IP where the service run and the port on the server.

    Public ports can be different from the ones on the local servers. E.g. internally the local IIS runs HTTPS on port 443 but your hosting provider forwarded it publicly to 8443. Sometimes forwarded ports are put much higher for non-so public services in the allowed range (up to 64k) to reduce automatic port scanners and attack tools as they check well known ports instead of full port range scan, which can be detected and ban the IPs.

  7. #7
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Unable to Access MySQL Remotely

    Now I read what OptionBase1 wrote. The reason to hide databases behind firewall is to reduce chances of attack. You have to create web services which will work with limited set of data for your application only so it will not expose full access to all other data on the db server. At least in theory this is the better approach because many times publicly accessible databases were left with default passwords and with disabled by default encryption.

  8. #8

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    Brief update. I had a revelation and remembered that the IP address has a domain name, so I tried to connect using the domain name instead and I'm no longer getting this error:
    Unable to connect to any of the specified MySQL hosts.
    However, I am getting a new error. The connection string I'm using is:
    datasource=-domainname-.com;port=3306;username=dotnet;password=--password--;database=adriaticmarine;
    The error that I'm getting now is:
    Authentication to host '-domainname-.com' for user 'dotnet' using method 'mysql_native_password' failed with message: Access denied for user 'admin'@'xxx-xxx-xxx-xxx.lightspeed.nworla.sbcglobal.net' (using password: YES)
    I find it odd that it is prepending my ISP information at the end of the IP addres, but maybe that's right? I dunno.

    I went back to the server and pulled up MySQL Workbench, opened Users and Privileges, selected the user dotnet and this is the information:
    • Login
      • Login Name: dotnet
      • Authentication Type: Standard
      • Limit to Host Matching: %
    • Account Limits
      • Max. Queries: 0
      • Min. Queries: 0
      • Max. Connections: 0
      • Concurrent Connections: 0
    • Administrative Roles - Everything is checked
    • Schema Privileges - % (everything is checked)


    I know that my username/password are valid because it is the same credentials that I'm using in my PHP website. It's worth noting that my password does have a dollar sign character ($) and in my PHP code it is being escaped, but it is being escaped because of how PHP's string interpolation works. I've tried connecting without and without escaping the dollar sign ($ and \$) in the connection string, but the same access denied email gets thrown. There is also a top hat character in the password too (^) but as far as I know, that is not any kind of reserved character.
    Last edited by dday9; Jun 8th, 2021 at 11:07 PM.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  9. #9
    PowerPoster ChrisE's Avatar
    Join Date
    Jun 2017
    Location
    Frankfurt
    Posts
    3,045

    Re: Unable to Access MySQL Remotely

    peterst is right with ...It is job of the network admin to setup port forwarding and to give you these details

    here a step by step sample with the Fritzbox just to show what "port forwarding" means
    https://support.zen.co.uk/kb/Knowled...ort-Forwarding
    to hunt a species to extinction is not logical !
    since 2010 the number of Tigers are rising again in 2016 - 3900 were counted. with Baby Callas it's 3901, my wife and I had 2-3 months the privilege of raising a Baby Tiger.

  10. #10
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Unable to Access MySQL Remotely

    Access denied for user 'admin'@'
    Seems that admin user was used or MySQL handles the your user as admin. Can you directly (no VPN) connect to external host using MySQL Workbench or some similar tool (SqlYog Community, HeidiSQL or DBeaver) with the user you set?

  11. #11

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    That was a typo. I tried using two different users, admin and dotnet (I copied the error from the former).

    I can try again tomorrow to see if I can hit it from MySQL Workbench from my machine without using a VPN.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  12. #12
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Unable to Access MySQL Remotely

    Think of Port-forwarding like forwarding a phonecall from one phone to another

    On the router you can say: All incoming requests for Port 12345 is to be forwarded to mysqlserver.mydomain.com Port 3306 (or instead of FQDN you can use the IP-address if it's static),
    like a phonecall: say, you're out-of office today, and on your office-phone (e.g. +1-888-555-1234) you can forward any call to your mobile/cell-phone (+1-999-444-6789).
    In that example your office-phone would be the "router"

    Nota bene: What the others said that forwarding access to a Database is a bad idea not withstanding: Never ever use the standard-port on your router! Port 3306 is well known world wide.
    You can tell the Router (see my example to use any port you choose (should be in the "user"-range of port-numbers (>10000?)- don't remember the exact word) to accept request on Port 12345, which gets forwarded to the internal Port 3306 of the MySQL-Machine.
    Yes, i'm aware that it's "Security through obscurity/obfuscation", but you shouldn't make it any easier for the hackers as is

    EDIT: A few notes on your setup
    I see you found the two usual culprits not being able to access MySQL from another machine:
    1) The host of the User
    2) The Bind_address-Parameter

    @1) Never ever configure root to be 'root'@'%' -->Never! Period! You (correctly) created a second User with sufficient GRANTS
    If you ever have to work as root, rather SSH into the Server, and work "locally", usually on the console.
    I'm doing it that way on our server in my skydiving-club, albeit i admit: We have FreeBSD as Server-OS

    @2) Something to consider setting Bind-Address to 0.0.0.0 (listen to requests to any NIC, NOT to any remote Machine):
    I remember being in a discussion on a german forum where a user had some issues with a MySQL-Server.
    The thing was: That MySQL-Server had 2 Network-Cards. And each card had its own IP-Address.
    That server was a member in 2 different LAN's (different in Address-Range), one was a 10.A.B.C-Network, the other was a 10.X.Y.Z-Network.
    Basically, there were 2 departments the server was a member of, for the first one it was a file-server, for the other department a MySQL_Server with employee-Data (Salaries etc.)
    The IT-Tech also set Bind_Address to 0.0.0.0, and was then confused, how a employee of Dept. 1 (File-Server) was able to hack himself into the MySQL-Server and read what the Boss earns!!!!
    IIRC, you can tell the MySQL-Server to listen only to that NIC(s), if it's more than one NIC i think you can separate the Addresses with comma (or was it semicolon?).
    EDIT: Just found out: Multiple IP-addresses/NIC only since MySQL8.0.13. Any older either 0.0.0.0 or one dedicated NIC (e.g. 10.10.1.100)

    Something else to consider: If you have a DynDNS-Setup, you also must open/forward the port at your DynDNS-Provider (and even there you could use a different port, AGAIN!)
    At DynDNS: Port 54321 forward to Router Port 12345 forward to mysql.mydomain.com Port 3306
    Last edited by Zvoni; Jun 9th, 2021 at 06:44 AM.
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  13. #13

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    I attempted to connect via MySQL Workbench, but it failed with a similar error:
    Failed to Connect to MySQL at -domainname-.com:3306 with user dotnet

    Access denied for user 'dotnet'@'xxx-xxx-xxx-xxx.lightspeed.nworla.sbcglo...
    (using password: YES)
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  14. #14
    A SQL Server fool GaryMazzone's Avatar
    Join Date
    Aug 2005
    Location
    Dover,NH
    Posts
    7,495

    Re: Unable to Access MySQL Remotely

    Did you check the users table in MySQL? There is a host column is that location in that column for that user? You can use % in the host column also (that would mean anywhere)
    Sometimes the Programmer
    Sometimes the DBA

    Mazz1

  15. #15
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Unable to Access MySQL Remotely

    What GRANT‘s does that user have?
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

  16. #16

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    For what it's worth, this is what is returned in the mysql.user table for dotnet:
    Code:
    	%	dotnet	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y	Y		...	...	...	0	0	0	0	mysql_native_password	--authentication string r	N	2021-06-08 00:04:56		N	Y	Y
    This is field names:
    • Host
    • User
    • Select_priv
    • Insert_priv
    • Update_priv
    • Delete_priv
    • Create_priv
    • Drop_priv
    • Reload_priv
    • Shutdown_priv
    • Process_priv
    • File_priv
    • Grant_priv
    • References_priv
    • Index_priv
    • Alter_priv
    • Show_db_priv
    • Super_priv
    • Create_tmp_table_priv
    • Lock_tables_priv
    • Execute_priv
    • Repl_slave_priv
    • Repl_client_priv
    • Create_view_priv
    • Show_view_priv
    • Create_routine_priv
    • Alter_routine_priv
    • Create_user_priv
    • Event_priv
    • Trigger_priv
    • Create_tablespace_priv
    • ssl_type
    • ssl_cipher
    • x509_issuer
    • x509_subject
    • max_questions
    • max_updates
    • max_connections
    • max_user_connections
    • plugin
    • authentication_string
    • password_expired
    • password_last_changed
    • password_lifetime
    • account_locked
    • Create_role_priv
    • Drop_role_priv
    • Password_reuse_history
    • Password_reuse_time
    • Password_require_current
    • User_attributes
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  17. #17
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    For the sake of ruling it out, have you verified by pinging the domain name you are using that it resolves to the same IP Address that you had been using previously?

  18. #18

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    I'm successfully able to to ping that domain.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  19. #19
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by dday9 View Post
    I'm successfully able to to ping that domain.
    Not what I asked. Does it resolve to the same IP address that you were using when you were connecting directly to an IP address?

    If not, then you might be attempting to solve the problem that your credentials don't let you in to someone else's database, which of course is a non-solvable issue.

  20. #20

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    Oh, my apologies I misunderstood. I have no idea how to check that.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  21. #21
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Unable to Access MySQL Remotely

    What does a tracert command show for that domain?

    https://www.lifewire.com/tracert-command-2618101

  22. #22

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    When I do a tracert on the domain, the opening message says:
    Tracing route to --domain--.com [xxx.xxx.xxx.xxx]
    The IP address in the brackets does not match up with the IP address that works when I change the connection string to be used with a VPN (like not even close). 14 rows get returned, none of the IP addresses match up with the internal IP address and the only row that times out is:
    8 * * * Request timed out.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  23. #23
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    You weren't kidding above then...

    Command prompt
    Type ping domain.youareusing.toconnect
    You should see the IP address that it is resolving to in each of the reply lines.

    Can't assist further, good luck.

  24. #24

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    Ok. When I ping the domain the IP address that it is resolving to does not match the IP address that I was using when a successful connection was made over a VPN.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  25. #25
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by dday9 View Post
    Ok. When I ping the domain the IP address that it is resolving to does not match the IP address that I was using when a successful connection was made over a VPN.
    Presumably when you connect via VPN you are connecting to the internal IP address of the device, so that will never match.

    Backing up like 20 posts. You said when you attempted to connect to the Public IP address of your server when not connected to the VPN is when you were failing. Then, you said that when you changed from using the Public IP Address to the domain name suddenly you got a different error.

    This whole line of troubleshooting was to determine if the domain name is pointing to the External IP address. Is it? Is the IP address from the domain name ping equal to the Public IP Address you were trying to connect to earlier? If not, then the last half of this thread has been chasing down an impossible to solve issue.

  26. #26

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    Oh, I see what you're saying.

    No, the domain name is not pointing to the external IP address of the machine that is serving the MySQL server. So presumably I need to change that back in my connection string to the public IP address.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  27. #27
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,393

    Re: Unable to Access MySQL Remotely

    For external (internet) connections, the connection string should have the external IP that the MySQL server is using for internet connections. Depending on how you have things set up, you may need an IP address translation rule somewhere (router, firewall, etc.).

  28. #28
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Unable to Access MySQL Remotely

    Well, dday9 connects to external IP to MySQL but he has no rights to access it. The error message is explicit: "Access denied for user dotnet" so the problem is not the connection, nor the IP. MySQL needs some administration but I can't help as every setup is different.

  29. #29
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by peterst View Post
    Well, dday9 connects to external IP to MySQL but he has no rights to access it. The error message is explicit: "Access denied for user dotnet" so the problem is not the connection, nor the IP. MySQL needs some administration but I can't help as every setup is different.
    That's not correct. The Access denied error message started when he changed the connection from his known public IP address to a dns domain name. The posts above demonstrate that it was determined that the dns domain name is not pointing to his public IP address but rather some other IP address. That leads me to believe that his attempt to connect via the dns domain name was causing him to connect to some other device, which is publishing access to MySQL publicly, but of course his credentials won't work on it because it isn't his IP/server/instance of MySQL.

    I can't spend more time on this, but this sounds like it is a bit beyond a "see if forum people can walk me through this" kind of issue, especially with dday's admitted lack of knowledge of networking things.

  30. #30

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    This is what is so frustrating about the whole issue. I am a web/software/database developer, not a networking/IT/database admin guy.

    Usually when I create a website, I will buy a domain name from GoDaddy and hosting services from Host Gator, upload my files to Host Gator via cpanel, create my database via phpMyAdmin, update my configurations and I'm good to go. This is the first time I'm trying to deploy to an on-prem machine and what makes this particularly stressful is that the on-prem machine uses IIS, did not have PHP installed, nor did it have MySQL installed.

    At this point I feel like I've spent more time trying to deploy my projects than I spent actually developing them. I read about the common pitfalls with setting up MySQL to allow for remote access such as the bind-address, users, and firewall issue, thought that I set everything up properly, but it is obvious that I didn't because I can't connect remotely from my VB.NET project.

    Plus there's no obvious error that I can go off of to know what to research. At this point, it is just the MySQL remote access issue that is preventing me from 100% being deployed, and it feels like I'm just spinning my wheels.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  31. #31
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    I'm assuming you are using Windows 10 for your development/testing of this stuff. I believe Windows 10 doesn't come with the Telnet command installed by default (you can check by typing Telnet at a command line. If it isn't recognized, it isn't installed. You'll have to look on Google for the exact steps to install it).

    Once it is installed, from a command prompt type:
    Telnet 10.0.0.1 555 (replacing 10.0.0.1 with your public IP address and 555 with the port that MySQL is supposed to be listening on)

    If it comes back with a message about the connection failed, then that port isn't open to the public on that IP address. Meaning you won't be able to connect no matter what credentials you use or what security you set from a database standpoint because the communication port isn't open to connect to.
    If it connects, I'm not sure what you'll see, perhaps just a blank screen with a blinking cursor in the upper-left corner of the screen, in which case that would indicate that the port is open.

    You seem to indicate that you've made all appropriate changes to the hosted server itself to get this working, but there is going to be a firewall of some sort between the outside world and your hosted Windows server that you may or may not have access to make changes to.

    This whole thing could just be that you need to ask your hosting provider to open up a port in their firewall that allows traffic and maps PublicIPAddress:MYSQLPORT -> ServerInternalIPAddress:MYSQLPORT

  32. #32
    Fanatic Member
    Join Date
    Jun 2019
    Posts
    557

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by OptionBase1 View Post
    That's not correct. The Access denied error message started when he changed the connection from his known public IP address to a dns domain name. The posts above demonstrate that it was determined that the dns domain name is not pointing to his public IP address but rather some other IP address. That leads me to believe that his attempt to connect via the dns domain name was causing him to connect to some other device, which is publishing access to MySQL publicly, but of course his credentials won't work on it because it isn't his IP/server/instance of MySQL.

    I can't spend more time on this, but this sounds like it is a bit beyond a "see if forum people can walk me through this" kind of issue, especially with dday's admitted lack of knowledge of networking things.
    This is quote from first post :
    Unable to read data from the transport connection: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
    It is not "access denied". It points that there is connection problem. So the problem is something different. And "Access denied for user xxx" sounds like there is connection to the MySQL server but another problem occurred like MySQL access rights.

  33. #33
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by peterst View Post
    This is quote from first post :


    It is not "access denied". It points that there is connection problem. So the problem is something different. And "Access denied for user xxx" sounds like there is connection to the MySQL server but another problem occurred like MySQL access rights.
    You seem to now be arguing with yourself because your earlier post references access denied messages, now you say that isn't the error message.

    Read all the posts. He received different error messages when he was connecting to public IP vs when he was connecting to a dns domain name which was determined to not be pointing to his public IP address.

    I'm done trying to help you with dday's problem.

  34. #34

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by OptionBase1 View Post
    I'm assuming you are using Windows 10 for your development/testing of this stuff. I believe Windows 10 doesn't come with the Telnet command installed by default (you can check by typing Telnet at a command line. If it isn't recognized, it isn't installed. You'll have to look on Google for the exact steps to install it).

    Once it is installed, from a command prompt type:
    Telnet 10.0.0.1 555 (replacing 10.0.0.1 with your public IP address and 555 with the port that MySQL is supposed to be listening on)

    If it comes back with a message about the connection failed, then that port isn't open to the public on that IP address. Meaning you won't be able to connect no matter what credentials you use or what security you set from a database standpoint because the communication port isn't open to connect to.
    This is what I get when running telnet using the public IP address:
    c:\>telnet xx.xx.xxx.xx 3306
    Connecting To xx.xx.xxx.xx...Could not open connection to the host, on port 3306: Connect failed
    So it seems like something is blocking it.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  35. #35
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by dday9 View Post
    This is what I get when running telnet using the public IP address:


    So it seems like something is blocking it.
    At this point this is the time to contact your hosting provider and explain that you need to be able to access MySQL externally from port 3306. It is possible you have the ability to configure that with whatever tools your hosting provider gives to its customers, but it is also possible that they need to do it themselves. In either case, they should be able to at least point you in the right direction.

    Good luck.

  36. #36

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    This is the response from their IT guy when I sent him a screenshot of my telnet request:
    I created an access rule with a port translation NAT rule for port 3306. I can double check all the settings and run additional testing to see but I remember from the other night that I didn’t even show any traffic hitting the outside interface from my public IP so I am not sure.
    I have no idea what that means other than perhaps he thinks he's set it up properly?

    Edit - It looks like we posted around the same time. I'll sync up with him and relay what you said.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  37. #37
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Quote Originally Posted by dday9 View Post
    This is the response from their IT guy when I sent him a screenshot of my telnet request:


    I have no idea what that means other than perhaps he thinks he's set it up properly?

    Edit - It looks like we posted around the same time. I'll sync up with him and relay what you said.
    His response sounds like the right things have been set up. His note at the end seems a bit confusing, almost as if he tried to test things out but wasn't able to connect himself?

    When you are connected via the VPN and connecting to the server's internal IP address, you are also connecting to port 3306, correct?

    Edit: Yes, I see from your opening post you are.

    I would still contact them and explain that you can't telnet to publicip on port 3306. They should be able to look in their firewall logs and at least see the connection attempt(s) and then hopefully be able to see what the problem is after that. It is possible that the firewall rule is in place and proper and is forwarding the traffic to your Windows box but that the actual Windows server is refusing the connection for some unknown reason.
    Last edited by OptionBase1; Jun 9th, 2021 at 04:48 PM.

  38. #38

    Thread Starter
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,712

    Re: Unable to Access MySQL Remotely

    Yes, the only thing that changes is datasource part of the connection string.
    "Code is like humor. When you have to explain it, it is bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

  39. #39
    PowerPoster
    Join Date
    Nov 2017
    Posts
    3,116

    Re: Unable to Access MySQL Remotely

    Note: I edited my last post while you were replying.

    I'll be curious what info they can provide to you. Until then I don't think I have any other suggestions. Good luck.

  40. #40
    PowerPoster Zvoni's Avatar
    Join Date
    Sep 2012
    Location
    To the moon and then left
    Posts
    4,418

    Re: Unable to Access MySQL Remotely

    I still haven't seen mention, that the apropriate ports on the Router have been forwarded!!
    And it's the Router serving as the public-IP-Address of the Network the MySQL-Server is a member of (Not the Domain you're using for that WebSite).

    Fact: I know that it works, since i did that on our Router / MySQL-Server in the beginning so that i could continue setup from home (No Live-data in the Database at that time)
    Last edited by Zvoni; Tomorrow at 31:69 PM.
    ----------------------------------------------------------------------------------------

    One System to rule them all, One Code to find them,
    One IDE to bring them all, and to the Framework bind them,
    in the Land of Redmond, where the Windows lie
    ---------------------------------------------------------------------------------
    People call me crazy because i'm jumping out of perfectly fine airplanes.
    ---------------------------------------------------------------------------------
    Code is like a joke: If you have to explain it, it's bad

Page 1 of 2 12 LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width