MySQL uses port number 3306 by default.
The MySQL protocol uses the 3306 port number to connect to MySQL clients, utilities such as "mysqldump". It's a TCP, Transmission Control Protocol.
Let's see if there are any vulnerabilities when using this default port -
In general, port 3306 should not be opened as it may make the server vulnerable attack. If users need to connect to the database remotely, there are many other security options than opening port 3306.
One of the security options includes using an SSH tunnel. On the other hand, if port 3306 needs to be opened, the user must ensure that the IP addresses that can access the port are restricted so that untrusted hosts cannot access the connection. Although the MySQL default port is 3306, this does not necessarily mean that the MySQL service will always use that port.
If the user wants to verify the port or see if MySQL is using a different port, this can be done by running a short SQL query.
SHOW VARIABLES WHERE Variable_name = 'port';
The above is the detailed content of What is the default port number for MySQL?. For more information, please follow other related articles on the PHP Chinese website!