Two query methods: 1. Open the terminal and directly execute the "netstat -anp|grep mysql" command. You can view the mysql port number in the output result. 2. Open the terminal, execute the "mysql -uroot -p" command to log in to the mysql server, and then execute the "show global variables like 'port';" command to query the mysql port. The number displayed in the "port" line in the output result is the mysql port.
The operating environment of this tutorial: linux7.3 system, mysql8 version, Dell G3 computer.
Two ways to query the mysql port on Linux
##Method 1: Open the terminal and directly execute the following command
netstat -anp|grep mysql
Method 2: Log in to the mysql server and query the mysql port
1. Open the terminal and execute themysql -uroot -p command to log in to mysql
show global variables like 'port'; command to view the port number
mysql video tutorial]
The above is the detailed content of How to query mysql port in linux. For more information, please follow other related articles on the PHP Chinese website!