1

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

1 Answer 1

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.

8
  • 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 Commented Oct 3, 2012 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 Commented Oct 3, 2012 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 0.0.0.0 I think. Commented Oct 3, 2012 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? Commented Oct 3, 2012 at 13:42
  • Sorry I understood you to put my local adress. OK so you suggest to change from bindadress 127.0.0.1 to 0.0.0.0 am I right? Commented Oct 3, 2012 at 13:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.