I got the server and on it is some mysql database TEST. I tried connected on it with my root account by using DBVisualizer but I keep getting could not connect check host name and port.

I tried with root account and also with TEST user account. Their passwords are OK.

with command

mysql> show databases;

I found my TEST database. I do not know any other parameters how to connect to database? I suppose either root or test can connect to it. How to check on which port is the database or does it have to be active?

I tried with netstat and this is my response? what does it mean?

netstat -an | grep -i mysql
unix  2      [ ACC ]     STREAM     LISTENING     8596     /var/run/mysqld/mysqld.sock


migrated from stackoverflow.com Oct 9 '12 at 7:02

This question came from our site for professional and enthusiast programmers.


It seems that your mysql connection is only listening by unix sockets and now by the actual TCP.

To solve that, go to your configuration file, usually on /etc/mysql/ folder with the name my.cnf on Ubuntu(if you are using some other system should be similar).

In the configuration file you should have a section called [client].

make your server to listen on by:

port        = 3306
#socket     = /var/run/mysqld/mysqld.sock
host =

And than restart the server.

Now you should have access to the mysql shell by doing on your command line.

mysql -U TEST -h -p db_name

Or you can use any other client you want.

  • hi, thanks for reply i am having some progress. now I can make new connection in DBVisualizer but I still can not connect. mysql is on server and my ip adress is so now when i try telnet I am getting Host is not allowed to connect to this MYSQL server – Dejan Oct 3 '12 at 13:19
  • I suppose it has something to do with bind address field ghacks.net/2009/12/27/… it says it should be commented and granted privileges on my ip adress but that is stupid because every day on work I will have another IP adress – Dejan Oct 3 '12 at 13:22
  • Hi, now all you have to do its to bind your address(IP). Go to the same file and and look for the bind-address option. It should be I think. – andrefsp Oct 3 '12 at 13:34
  • do I have to change and bind address and host that you added?? but tomorrow I will have another IP address on my work does it sound silly to change every day address in that file? – Dejan Oct 3 '12 at 13:42
  • Sorry I understood you to put my local adress. OK so you suggest to change from bindadress to am I right? – Dejan Oct 3 '12 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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