Saturday, October 1, 2016

How to Check the Connection to MySQL DB Server in linux?


I would share the way to check the connection to MySQL database server. We can use the telnet or nc command to connect to port 3306. This would be very useful when we do the troubleshooting or to test the connectivity between the application server and the database server. Sample outputs will show succeeded or connected as below :

Host A = 192.168.0.5
Host B = 192.168.0.6

1. Test connectivity using nc command :

[root@linuxforfreshers~]# nc -z -w1 192.168.0.6 3306
Connection to 192.168.0.6 3306 port [tcp/mysql] succeeded!
2. Test connectivity using telnet command :
syntax: telnet hostname portnumber

[root@linuxforfreshers~]#  telnet  192.168.0.6 3306
Telnet escape character is 'X'.
Trying 192.168.0.6...
Connected to 192.168.0.6.
Escape character is 'X'.


telnet> Connection closed.

No comments:

Post a Comment