MySQL修改端口
文章目录
- 一、mysql 查看端口
- 二、netstat 查看端口
- 三、修改my.cnf
- 四、重启mysql
- 五、netstat 再次查看
一、mysql 查看端口
[root@localhost ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 723
Server version: 5.7.33 MySQL Community Server (GPL)
Copyright (c) 2000, 2021, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show global variables like 'port';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| port | 3306 |
+---------------+-------+
1 row in set (0.01 sec)
mysql> exit
Bye
二、netstat 查看端口
[root@localhost ~]# netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::3306 :::* LISTEN 3115/mysqld
tcp6 0 0 :::6379 :::* LISTEN 1852/redis-server *
三、修改my.cnf
vim /etc/my.cnf
四、重启mysql
systemctl restart mysqld
五、netstat 再次查看
[root@localhost ~]# netstat -nplt
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp6 0 0 :::19306 :::* LISTEN 25953/mysqld
tcp6 0 0 :::6379 :::* LISTEN 1852/redis-server *
觉得好,就一键三连呗(点赞+收藏+关注)
还没有评论,来说两句吧...