Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

The connection worked fine the other day and for some reason is doesn't. MySQL is running in Ubuntu Server 12.04 and I am trying to connect to a database using ODBC Connector 5.1 from Windows 7.

I have tried commenting out and keeping the bind-address in the cnf file. I have tried to grant all access. I have been reading endless amounts of tutorials and posting to attempt to figure it out. I cannot figure out what is going on, also I am a newbie to all this and I have noticed that most posting leave out some minor things that others may be attuned to.

Help! Thanks in advance.

The service is running and I get the following from netstat -tlpen | grep mysql:

tcp  0*  LISTEN  106  15172  3565/mysqld

I get the following from netstat -tlpen:

    Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       User       Inode       PID/Program name
tcp        0      0  *               LISTEN      106        15172       3565/mysqld     
tcp        0      0   *               LISTEN      0          7092        776/smbd        
tcp        0      0   *               LISTEN      0          8325        784/rpcbind     
tcp        0      0 *               LISTEN      0          9759        1325/perl       
tcp        0      0 *               LISTEN      0          9584        -               
tcp        0      0    *               LISTEN      0          8809        947/sshd        
tcp        0      0   *               LISTEN      0          7090        776/smbd        
tcp        0      0  *               LISTEN      0          9000        -               
tcp6       0      0 :::139                  :::*                    LISTEN      0          7088        776/smbd        
tcp6       0      0 :::111                  :::*                    LISTEN      0          8328        784/rpcbind     
tcp6       0      0 :::22                   :::*                    LISTEN      0          8811        947/sshd        
tcp6       0      0 :::445                  :::*                    LISTEN      0          7085        776/smbd        
tcp6       0      0 :::2049                 :::*                    LISTEN      0          9003        -               
tcp6       0      0 :::47906                :::*                    LISTEN      0          9586        -     

iptable -L

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  

enter image description here

share|improve this question
Without any further info, that would be hard to answer. You need to tell us the output of netstat -tlpen, the one of iptables -L and what is the error message you get when trying to establish the ODBC connection. That will be a good start already, further info would probably still be needed! – Huygens Mar 3 '13 at 16:34
I added to my original question with the things you mentioned. – LandArch Mar 3 '13 at 20:30
So from a network point of view, it looks alright. Now it is about the user accounts, how did you configure the user account you are using for the ODBC connection? Or about security policies, have you check if you are using AppArmor? Check if you have something denied as reported by AppArmor in either audit.log, syslog or messages (files that you can find under /var/log) – Huygens Mar 3 '13 at 21:01
AppArmor is not installed from what I can tell. I followed the white paper developed by the program that I am trying to connect. It is accessible from…. I commented out the bind address in my.cnf, I have also tried it with and the servers ip. – LandArch Mar 4 '13 at 13:14
Could you tell us the exact error message ODBC Connector is returning and could you activate the logs in MySQL and see if it reports any error while connecting? You can check this answer how to configure MySQL logging: – Huygens Mar 5 '13 at 9:49

2 Answers 2

Sounds like you've checked everything that can be wrong with MySQL. The next thing I would check is to see if MySQL is still running and listening on the correct port.

service mysql status

If it is note running, start it:

service mysql start

After that, I would make sure it's still listening on the default port by running

netstat -tlpen | grep mysql

The default port for MySQL is 3306 so it should return something like this:

tcp 0 0* LISTEN 107 8073 790/mysqld

share|improve this answer
Note: if netstat reports that it is listening on then MySQL Server is bound to the local interface only and cannot be used via the network. – Huygens Mar 3 '13 at 20:40
up vote 0 down vote accepted

I finally figured out what was going on. It turns out that the static ip that I set for my server was not completely establishedand upon reboot another computer on my LAN grabbed the ip address that I dictated for the server.

sudo nano /etc/network/interfaces

and changed the information similar to this tutorial, using the information realted to my LAN.

Instead of changing the resolv.conf file as the tutorial states I added:

dns-nameserver XX.XX.XX.XX
dns-nameserver XX.XX.XX.XX

as two additional lines at the bottom of the interfaces file. XX.XX.XX.XX are replaced with the dns-nameservers that I identified from my router. Other information that I read indicates that you could use others, i.e. Google or OpenDNS. Once that was done and the network was restarted, I had to remove dhcp-client from the server. Without doing this the static ip address does not maintain upon restarting the server.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.