Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to modify the port number of mysql under linux

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly explains how to modify the port number of mysql under linux. Interested friends may wish to take a look. The method introduced in this paper is simple, fast and practical. Let Xiaobian take you to learn how to modify the port number of mysql under linux!

How to modify the port number: 1. Log in to mysql;2. Use "show global variables like 'port';" to view the port number;3. Edit the file "/etc/my.cnf", find the "port" item, and modify its value to the required port number;4. Restart mysql.

This tutorial operates on Linux 5.9.8, MySQL8, Dell G3.

Step 1: Log in to mysql

mysql -u root -p//Enter password

Step 2: Check the port number

Use the command show global variables like 'port';

mysql> show global variables like 'port';+---------------+-------+| Variable_name | Value |+---------------+-------+| port | 3306 |+---------------+-------+1 row in set (0.00 sec)mysql>

3306 is the port number.

Step 3: Modify the port

Edit the/etc/my.cnf file, find the port line of mysql configuration file my.cnf, and modify the previous port 3306 to what you want.

Early versions may be my.conf file name, add port parameters, and set the port, note that the port is not used, save exit.

[root@test etc]# vi my.cnf[mysqld]port=3506 ##This is the line datadir=/var/lib/mysql socket =/var/lib/mysql/mysql.sock

I didn't fully display the mysql configuration file, find the port is enough, and then:wq launch and save

Step 4: Restart mysqlsystemctl restart mysql or/etc/init.d/mysqld restart Here, I believe that everyone has a deeper understanding of "how to modify the port number of mysql under linux", may wish to actually operate it! Here is the website, more related content can enter the relevant channels for inquiry, pay attention to us, continue to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report