When trying to connect to mysql server via telnet I am getting following error:
telnet localhost 3306
Trying ::1...
Trying 127.0.0.1...
telnet: Unable to connect to remote host: Connection timed out
I tried telnet with 127.0.0.1, hostname
also, but getting same error message. But I can connect with mysql -u username -p
once I am in the server.
Here is the result of netstat:
netstat -na | grep mysql
unix 2 [ ACC ] STREAM LISTENING 4540495 /var/run/mysqld/mysqld.sock
netstat -na | grep 3306
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN
What could be possible problems? If you need some more details I could provide it without any problems.
Thanks a lot.
Can you connect with:
If not, check whether your server was started 'skip-networking' enabled:
Which indicates 127.0.0.1 will not work, but localhost will. In mysql localhost and 127.0.0.1 are different hosts.
Further things to check:
are you running the default port (3306)? Check your my.cnf or do
mysqladmin -h localhost -p variables | grep port
I got same problem and i resolved . I use Mac pro & sequel Pro as mysql client , socket localhost connection succeeded but standard tcp/ip Connection failed!
and I check my running port by using cmd :
here is my result status:
It's porting 3307 not default 3306 , there was another mysql server installed once . so change it and resolved. tks @DTest 's answer.