Take the 2-minute tour ×
Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. It's 100% free, no registration required.

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

Thanks

share|improve this question

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

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

1 Answer 1

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 127.0.0.1:3306 by:

[client]
port        = 3306
#socket     = /var/run/mysqld/mysqld.sock
host = 127.0.0.1

And than restart the server.

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

mysql -U TEST -h 127.0.0.1 -p db_name

Or you can use any other client you want.

share|improve this answer
    
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 192.168.0.1 and my ip adress is 192.168.0.55 so now when i try telnet I am getting Host 192.168.0.55 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 192.168.0.55 but that is stupid because every day on work I will have another IP adress –  Dejan Oct 3 '12 at 13:22
    
but as I said I have progress now I can "hear" my mysql database but I still can not connect because my ip adress is not transmitted to my sql server. of course i can ping server –  Dejan Oct 3 '12 at 13:24
    
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 0.0.0.0 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

Your Answer

 
discard

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.