1024programmer Mysql How does mysql change the connection port

How does mysql change the connection port

How to change the connection port of mysql: first log in to mysql; then use the command [show global variables like & # 39; port & # 39;;] to check the port number; then modify the port; finally restart mysql.

【Related learning recommendation: mysql tutorial(video)】

How to change the connection port of mysql:

1. Log in to mysql

  mysql -u root -p
 //Enter the password

2. Use the command show global variables like 'port'; to view the port number

mysql> show global variables like 'port';

3. Modify the port

Edit /etc/my.cnf file, earlier version It may be the name of the my.conf file, add the port parameter, and set the port, note that the port is not used, save and exit.

[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. Restart mysql

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

For more programming learning, please pay attention to the PHP training column!

The above is the detailed content of how mysql changes the connection port. For more information, please pay attention to other related articles on 1024programmer.com!

This article is from the internet and does not represent1024programmerPosition, please indicate the source when reprinting:https://www.1024programmer.com/how-does-mysql-change-the-connection-port/

author: admin

Previous article
Next article

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索