Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 3258
  • Last Modified:

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)
0
rraymond1130
Asked:
rraymond1130
  • 9
  • 8
1 Solution
 
xtermCommented:
You need to edit the config file and replace the string "IP ADDRESS" with the actual IP address of your MySQL server.
0
 
rraymond1130Author Commented:
Which config file are you talking about? Remember I'm new to Linux.
0
 
xtermCommented:
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"?
0
Build your data science skills into a career

Are you ready to take your data science career to the next step, or break into data science? With Springboard’s Data Science Career Track, you’ll master data science topics, have personalized career guidance, weekly calls with a data science expert, and a job guarantee.

 
rraymond1130Author Commented:
I'm using the IP address of the linux server
0
 
xtermCommented:
Are you running a firewall on the Ubuntu box?

Please run on the Linux machine:

  /sbin/iptables -nL
0
 
xtermCommented:
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.
0
 
rraymond1130Author Commented:
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
0
 
xtermCommented:
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)
0
 
rraymond1130Author Commented:
Connecting To 1.1.1.1 ...Could not open connection to the host, on port 3306
: Connect failed
0
 
xtermCommented:
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
0
 
rraymond1130Author Commented:
netstat -na | grep :3306
tcp        0      0 127.0.0.1:3306          0.0.0.0:*               LISTEN
0
 
xtermCommented:
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.
0
 
rraymond1130Author Commented:
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.
0
 
rraymond1130Author Commented:
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?
0
 
xtermCommented:
Yes, you can do that in the mysql.db table through phpmyadmin.
0
 
xtermCommented:
Remember to reload mysql (or flush privileges) after you've added the entry to permit your host.
0
 
rraymond1130Author Commented:
xterm thanks for your help. I will document all of this.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 9
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now