Home > Database > Mysql Tutorial > body text

How to check the MySQL port under Linux

王林
Release: 2023-06-03 13:25:51
forward
6089 people have browsed it

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

1. Log in to mysql

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

2. Use show global variables like ‘port&rsquo ;; Command to view the port number,

mysql> show global variables like ‘port’; ————— ——- | Variable_name | Value | —— ——- | port | 3306 | ————— #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