rraymond1130
asked on
Can't get Heidsql to connect to mysql on ubuntu
I setup a LAMP server running on Ubuntu 12.4. I'm new to Linux. For some reason I can't get Heidisql to connect to mysql on my Ubuntu box. This is a fresh install. I can connect to phpmyadmin. The error I'm getting is: SQL Error (2003) in statement #0: Can't connect to MYSQL server on 'IP ADDRESS' (10061)
You need to edit the config file and replace the string "IP ADDRESS" with the actual IP address of your MySQL server.
ASKER
Which config file are you talking about? Remember I'm new to Linux.
Sorry, I didn't realize you were using the Windows GUI for Heidisql.
In the Heidi Session manager screen, what does it say in the box "Hostname/IP"?
In the Heidi Session manager screen, what does it say in the box "Hostname/IP"?
ASKER
I'm using the IP address of the linux server
Are you running a firewall on the Ubuntu box?
Please run on the Linux machine:
/sbin/iptables -nL
Please run on the Linux machine:
/sbin/iptables -nL
http://dev.mysql.com/doc/refman/5.6/en/can-not-connect-to-server.html
"The error (2003) Can't connect to MySQL server on 'server' (10061) indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server."
This definitely looks like a firewall related issue to me.
"The error (2003) Can't connect to MySQL server on 'server' (10061) indicates that the network connection has been refused. You should check that there is a MySQL server running, that it has network connections enabled, and that the network port you specified is the one configured on the server."
This definitely looks like a firewall related issue to me.
ASKER
This is what I get from the command above:
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Chain INPUT (policy ACCEPT)
target prot opt source destination
Chain FORWARD (policy ACCEPT)
target prot opt source destination
Chain OUTPUT (policy ACCEPT)
target prot opt source destination
Okay, so looks like no firewall.
From the Windows machine, please open cmd.exe (a DOS terminal window) and type the following:
c:\> telnet 1.2.3.4 3306
(substitute 1.2.3.4 with the IP of your Linux MySQL server)
From the Windows machine, please open cmd.exe (a DOS terminal window) and type the following:
c:\> telnet 1.2.3.4 3306
(substitute 1.2.3.4 with the IP of your Linux MySQL server)
ASKER
Connecting To 1.1.1.1 ...Could not open connection to the host, on port 3306
: Connect failed
: Connect failed
Okay, so your Linux box may not be listening for remote connections for whatever reason.
Please do from the Ubuntu machine and show me the result:
netstat -na | grep :3306
Please do from the Ubuntu machine and show me the result:
netstat -na | grep :3306
ASKER
netstat -na | grep :3306
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN
Okay, please open /etc/my.cnf and find the line "bind address" and change it from 127.0.0.1 to 0.0.0.0
Then you will need to restart MySQL (as root):
/etc/init.d/mysql restart
The problem is that by default on Debian/Ubuntu, MySQL by default is only set up for local connections and doesn't listen on any other interface than localhost.
After you restart MySQL, Heidisql will connect fine.
Then you will need to restart MySQL (as root):
/etc/init.d/mysql restart
The problem is that by default on Debian/Ubuntu, MySQL by default is only set up for local connections and doesn't listen on any other interface than localhost.
After you restart MySQL, Heidisql will connect fine.
ASKER
OK:
SQL Error (1130) in statement#0: Host 'my pc ip address' is not allowed to connect to this MySQL server.
Sounds like we have to give my ip permission to connect. I do remember having to do this on my Hostmonster account, but I was able to do that through the cpanel.
SQL Error (1130) in statement#0: Host 'my pc ip address' is not allowed to connect to this MySQL server.
Sounds like we have to give my ip permission to connect. I do remember having to do this on my Hostmonster account, but I was able to do that through the cpanel.
ASKER
I had to add my ip address into the Remote MySql Database, in order to use heidisql with my hostmonster MySQL. What would be the equivalent in this situation?
Yes, you can do that in the mysql.db table through phpmyadmin.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
xterm thanks for your help. I will document all of this.