Home > Database > Mysql Tutorial > body text

How to check the MySQL port under Linux

WBOY
Release: 2023-04-17 16:07:05
forward
1784 people have browsed it

The MySQL port defaults to 3306, but the MySQL port may be modified during the installation process.

How to check the MySQL port under Linux

1. Log in to mysql

[root@localhost ~]# mysql -uroot -pEnter password: Enter the database password;

2 , use the show global variables like ‘port’; command to view the port number,

mysql> show global variables like ‘port’; ————— ——- | Variable_name | Value | ————— ——- | port | 3306 | ##mysql>

3306 is the port number.

2. Modification of mysql port number

1. Edit the /etc/my.cnf file [root@localhost ~]# vi /etc/my.cnf

2 , add port=2032;

3, restart mysql [root@localhost ~]# /etc/init.d/mysqld restart

The above is the detailed content of How to check the MySQL port under Linux. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:yisu.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template