MySQL修改端口號


1. 登錄mysql

1
2
mysql -u root -p
//輸入密碼

  

2. 使用命令show global variables like 'port';查看端口號

1
mysql> show global variables like  'port' ;

  

3. 修改端口

編輯/etc/my.cnf文件,早期版本有可能是my.conf文件名,增加端口參數,並且設定端口,注意該端口未被使用,保存退出。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
[root@test etc] # vi my.cnf
[mysqld]
port=3506
datadir=/ var /lib/mysql
socket=/ var /lib/mysql/mysql.sock
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
 
[mysqld_safe]
log-error=/ var /log/mysqld.log
pid-file=/ var /run/mysqld/mysqld.pid
 
"my.cnf"  11L, 261C written
[root@test etc] #

  

4. 重啟mysql

1
2
3
[root@test ~] # /etc/init.d/mysqld restart
Stopping mysqld: [ OK ]
Starting mysqld: [ OK ]

文章轉自https://www.cnblogs.com/xuange306/p/8243182.html


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM