1. Log in to mysql.
Open the terminal and enter the command: "# mysql -uroot -p".
[root@localhost ~]# mysql -uroot -p
Enter password: Enter the database password;
2. Then enter the command "show global variables like 'port';" to view the port number.
mysql> show global variables like 'port'; +---------------+-------+ | Variable_name | Value | +---------------+-------+ | port | 3306 | +---------------+-------+ 1 row in set (0.00 sec)
Here 3306 is the port number.
The above is the detailed content of How to check the port number of mysql in ubuntu. For more information, please follow other related articles on the PHP Chinese website!