how to change the default 3306 port of mysql on CentOS 7, it's very simple.
step1:You need to edit your my.cnf(vim /etc/my.cnf), add or modify the line.
change the default port of mysql from 3306 to 3388, as follows.
- [mysqld]
- 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
- port=3388
- [mysqld_safe]
- log-error=/var/log/mysqld.log
- pid-file=/var/run/mysqld/mysqld.pid
step2:Restart mysql server on CentOS 7.
- # systemctl restart mysqld
step3:Check what port mysql is running on. run netstat -ntlp command.
- [root@VM_230_32_centos ~]# netstat -ntlp
- Active Internet connections (only servers)
- Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
- tcp 0 0 0.0.0.0:3388 0.0.0.0:* LISTEN 6944/mysqld
- tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 6998/httpd
- tcp 0 0 0.0.0.0:4369 0.0.0.0:* LISTEN 30342/epmd
- tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1062/sshd
- tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1154/master
thanks!
Amazing post.Thanks for your details and explanations..I want more information from your side.Thank you
ReplyDeleteGuest posting sites
Education