Error while remotely connecting to MySQL

Ask questions about dedicated servers here and we and other users will do our best to answer them. Please also refer to the self-help section for tutorials and answers to the most commonly asked questions.
Post Reply
Dwellingdragon
New to forums
New to forums
Posts: 8
https://www.youtube.com/channel/UC40BgXanDqOYoVCYFDSTfHA
Joined: Sun Feb 17, 2013 6:25 pm

Error while remotely connecting to MySQL

Post by Dwellingdragon »

I am getting an error connecting to my MySQL database from remote hosts, I can connect to the MySQL database fine via localhost applications, but not remote. Here is an example error I get with Multicraft:

2013-02-16 22:44:39,498 ERROR Failed to connect to MySQL: (2003, "Can't connect to MySQL server on 'direct.embercore.com' (113)")
2013-02-16 22:44:39,499 ERROR Database connection failed.
2013-02-16 22:44:39,499 WARNING Setting daemon info failed, please update your database.

---

Here is a set of tracert's and ping's from my NFO VDS going to the server that my multicraft daemon is running on:

root@embercore:/var/log/mysql# ping 199.96.84.1
PING 199.96.84.1 (199.96.84.1) 56(84) bytes of data.
64 bytes from 199.96.84.1: icmp_req=1 ttl=252 time=57.7 ms
64 bytes from 199.96.84.1: icmp_req=2 ttl=252 time=59.5 ms
64 bytes from 199.96.84.1: icmp_req=3 ttl=252 time=57.9 ms
64 bytes from 199.96.84.1: icmp_req=4 ttl=252 time=69.9 ms
64 bytes from 199.96.84.1: icmp_req=5 ttl=252 time=68.7 ms
64 bytes from 199.96.84.1: icmp_req=6 ttl=252 time=57.7 ms
tr64 bytes from 199.96.84.1: icmp_req=7 ttl=252 time=57.6 ms
acerou64 bytes from 199.96.84.1: icmp_req=8 ttl=252 time=58.4 ms
te 64 bytes from 199.96.84.1: icmp_req=9 ttl=252 time=62.9 ms
199.96.84.164 bytes from 199.96.84.1: icmp_req=10 ttl=252 time=57.7 ms
64 bytes from 199.96.84.1: icmp_req=11 ttl=252 time=57.7 ms
64 bytes from 199.96.84.1: icmp_req=12 ttl=252 time=57.6 ms
64 bytes from 199.96.84.1: icmp_req=13 ttl=252 time=57.8 ms
64 bytes from 199.96.84.1: icmp_req=14 ttl=252 time=93.8 ms
64 bytes from 199.96.84.1: icmp_req=15 ttl=252 time=57.8 ms
64 bytes from 199.96.84.1: icmp_req=16 ttl=252 time=57.8 ms
64 bytes from 199.96.84.1: icmp_req=17 ttl=252 time=57.5 ms
64 bytes from 199.96.84.1: icmp_req=18 ttl=252 time=57.5 ms
^C
--- 199.96.84.1 ping statistics ---
18 packets transmitted, 18 received, 0% packet loss, time 17028ms
rtt min/avg/max/mdev = 57.506/61.465/93.888/8.690 ms
root@embercore:/var/log/mysql# traceroute 199.96.84.1
traceroute to 199.96.84.1 (199.96.84.1), 30 hops max, 60 byte packets
1 10gigabitethernet1-3.core1.sea1.he.net (206.81.80.40) 0.327 ms 0.415 ms 0.491 ms
2 10gigabitethernet3-1.core1.den1.he.net (184.105.213.42) 33.474 ms 33.567 ms 33.501 ms
3 10gigabitethernet8-2.core1.chi1.he.net (72.52.92.233) 55.089 ms 55.122 ms 55.167 ms
4 * 10gigabitethernet5-2.core1.chi1.he.net (184.105.222.117) 55.438 ms *
5 10gigabitethernet6-1.core1.chi1.he.net (72.52.92.1) 65.377 ms * *
6 * * *
7 * * *
8 * * *
9 * * *

If you need any more info posted just let me know. I am able to connect to my mysql database via heidisql... I'm just confused.
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Error while remotely connecting to MySQL

Post by Edge100x »

You will likely need to reconfigure your MySQL server to bind to something other than localhost (127.0.0.1). To do this, find the MySQL configuration file (my.cnf, usually), and change the line starting with "bind-address" to have it bind to "0.0.0.0".
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

I did that (the entire line with bind-address was commented out with a # to begin with) and still no luck. I am getting this exact error:

02/17/2013 22:07:16 Devart.Data.MySql Can't connect to MySQL server on '66.150.164.156' (10061):
Connection refused


Should my /etc/hosts file look like this?:

Code: Select all

127.0.0.1       localhost
127.0.0.1       community.embercore.com
74.91.121.100   virtual-template

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Error while remotely connecting to MySQL

Post by Edge100x »

Is community.embercore.com supposed to point to the local server (127.0.0.1)?

Did you restart the MySQL server after changing the line?
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

I removed that weird line with community.embercore.com. I have restarted mysql and networking a few times and still nothing. I am completely lost at this point, I can connect to my server via heidisql, but not through any of my servers located in Continuum DataCenters
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Error while remotely connecting to MySQL

Post by Edge100x »

Do you have any sort of firewall enabled on either end, or does your other host have a firewall enabled?
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

I have UFW disabled, and iptables has nothing blocked. On both ends, remote machine and vps.
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

What I do not understand is this. Here is my remote server (Located in Chicago in Continuum Datacenters) trying to trace route to EmberCore.com which is on my VPS in Seattle hosted by NFO:

Code: Select all

root@chicago5:/home# traceroute direct.embercore.com
traceroute to direct.embercore.com (66.150.164.156), 30 hops max, 60 byte packets
 1  chi-b.aigaming.com (74.122.197.189)  0.527 ms  0.528 ms  0.525 ms
 2  edge-hurricane.chi.continuumdatacenters.com (184.105.249.201)  3.478 ms  1.349 ms  3.468 ms
 3  10gigabitethernet3-2.core1.den1.he.net (184.105.213.86)  29.025 ms  29.011 ms  29.012 ms
 4  10gigabitethernet3-4.core1.sea1.he.net (184.105.213.41)  56.573 ms  56.562 ms  56.557 ms
 5  * * *
 6  * * *
 7  * * *
 8  * * *
 9  * * *
10  *^C
root@chicago5:/home#

I am not sure what is cutting it off, and where.
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Error while remotely connecting to MySQL

Post by Edge100x »

You have general connectivity between the two, since one can ping the other.

Are you able to contact the MySQL server here using straight telnet (to port 3306)? Here's what I see from another machine in Seattle, and it's what it should show:
# telnet direct.embercore.com 3306
Trying 66.150.164.156...
Connected to direct.embercore.com.
Escape character is '^]'.
_
5.5.29-0ubuntu0.12.04.1-logÇ+r#PNrv~/hBNCCha/e2mysql_native_password
If you don't see that, you definitely have a firewall issue with your other host.
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

I get this error:


# telnet direct.embercore.com 3306
Trying 66.150.164.156...
telnet: Unable to connect to remote host: No route to host
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Error while remotely connecting to MySQL

Post by Edge100x »

You should ask your other host about their firewall, because this is really looking like a firewall problem.
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

They are telling me the same about NFO. Bottom line is that from my servers inside Continuum Datacenter in Chicago, there is no "Route to host" for some reason. I have no idea how to interpret that.

Telnet port 80:
root@h199-96-84-20:~# telnet direct.embercore.com 80
Trying 66.150.164.156...
telnet: Unable to connect to remote host: No route to host

Telnet port 3306:
root@h199-96-84-20:~# telnet direct.embercore.com 3306
Trying 66.150.164.156...
telnet: Unable to connect to remote host: No route to hos
User avatar
Edge100x
Founder
Founder
Posts: 13156
Joined: Thu Apr 18, 2002 11:04 pm
Location: Seattle
Contact:

Re: Error while remotely connecting to MySQL

Post by Edge100x »

Is that all they told you, or are they attempting to troubleshoot as we are? At this point, we can be reasonably confident that it's an issue with your server there, and most of the troubleshooting needs to be done there. They (theoretically) know more about their systems than I do, so they're in the best position to explore it with you.

Since you were able to ping that other company's IP from your service here, we know that there actually is a route between these two IPs. But, maybe the other server is initiating the connection from a different IP, and that is causing the problem.

Do you have an IP bound to that other machine which they're not allowing you to use, possibly? I've seen errors like this when a VDS customer is trying to use an old IP that he/she had removed from the package and needed to also remove from the machine.

Try using the "-b" option to manually bind telnet to the IP that you want to use:

Code: Select all

telnet -b 199.96.84.1 direct.embercore.com 3306
Dwellingdragon
New to forums
New to forums
Posts: 8
Joined: Sun Feb 17, 2013 6:25 pm

Re: Error while remotely connecting to MySQL

Post by Dwellingdragon »

Code: Select all

telnet -b 199.96.84.21 direct.embercore.com 3306
Trying 66.150.164.156...
telnet: Unable to connect to remote host: No route to host
Still no route.
Post Reply