
先来查看端口
root@:~# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 383
Server version: 5.5.68-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show global variables like ‘port’;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| port | 3306 |
+—————+——-+
1 row in set (0.01 sec)
MariaDB [(none)]>
下面进入vi修改端口,改红字修改的两个地方端口再 :wq保存即可
root@:~# vi /etc/my.cnf
[client]
#password = your_password
port = 3001
socket = /tmp/mysql.sock
[mysqld]
port = 3001
重启一下MariaDB服务
systemctl restart mariadb.service
再查看端口,就显示了我们修改的端口了
root@:~# mysql
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 5
Server version: 5.5.68-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
MariaDB [(none)]> show global variables like ‘port’;
+—————+——-+
| Variable_name | Value |
+—————+——-+
| port | 3001 |
+—————+——-+
1 row in set (0.00 sec)
MariaDB [(none)]>





![热网互联:美国洛杉矶cera机房深度测评,[2023]热网互联测评分享数据](https://img.ivpsr.com/wp-content/uploads/2022/02/rewanghulian0.jpg)
![教你win10删除无法删除的[特殊字符]造成非法路径等办法](https://img.ivpsr.com/wp-content/uploads/2021/03/1616149836-3d74637cfbed752.png)


