How to change the connection port in mysql

coldplay.xixi
Release: 2020-09-08 16:04:31
Original
16240 people have browsed it

Mysql method to change the connection port: first log in to mysql; then use the command [show global variables like 'port';] to view the port number; then modify the port; and finally restart mysql.

How to change the connection port in mysql

【Related learning recommendations:mysql tutorial(Video)】

Mysql method to change the connection port:

1. Log in to mysql

mysql -u root -p //输入密码
Copy after login

2. Use the commandshow global variables like 'port';Check the port number

mysql> show global variables like 'port';
Copy after login

3. Modify the port

Edit the /etc/my.cnf file. In earlier versions, it may be the my.conf file name, and add port parameters. , 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]#
Copy after login

4. Restart mysql

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

If you want to learn more about programming, please pay attention to thephp trainingcolumn!

The above is the detailed content of How to change the connection port in mysql. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!