一、查看默認端口號
1、登錄mysql
[root@localhost ~]# mysql -uroot -p
Enter password: 輸入數據庫密碼;
2、使用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即為端口號。
二、mysql端口號的修改
1、編輯/etc/my.cnf文件 [root@localhost ~]# vi /etc/my.cnf
2、添加port=2032;
3、重啟mysql [root@localhost ~]# /etc/init.d/mysqld restart
--------------------- 本文來自 此刻的丶 的CSDN 博客 ,全文地址請點擊:https://blog.csdn.net/b551500/article/details/79677655?utm_source=copy