MySQL修改端口

MySQL修改端口MySQL修改端口

一、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 * 

觉得好,就一键三连呗(点赞+收藏+关注)

今天的文章MySQL修改端口分享到此就结束了,感谢您的阅读,如果确实帮到您,您可以动动手指转发给其他人。

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/32027.html

(0)
编程小号编程小号

相关推荐

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注