mysql修改埠經驗

zping發表於2016-01-19

mysql更改埠
修改/etc/my.cnf
新增port=3308
修改後如下
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
port=3308
user=mysql
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
default-character-set=utf8
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

然後重啟mysql
如果你開啟了selinux,mysql會無法啟動,你會在日誌中看到以下錯誤

[ERROR] Can't start server: Bind on TCP/IP port: Permission denied
[ERROR] Do you already have another mysqld server running on port: 3308

那麼,你需要關掉selinux,不想重啟伺服器,而關掉selinux,使用以下命令

/usr/sbin/setenforce 0


修改linux下mysql埠時候報錯:

Can't start server: Bind on TCP/IP port: Permission denied

需要修改: vi /etc/selinux/config

SELINUX=disabled

然後重啟伺服器即可

相關文章