Mysql client port

I connect to a remote MySQL server (on the default port 3306) using the mysql_real_connect() C API call.

  • How to find out which TCP port is used on the client host?

  • Can I specify the port that I want to use?

+4
source share
1 answer

1

You can use lsof . Enter the following in the shell:

 $ lsof | grep TCP 

And then find the port on which your mysql server is listening.

You can also use netstat . Details can be found on man netstat .

2

As far as I know, you cannot.

0
source

All Articles