Linux CentOS MySQL Modify default port method

Source: Internet
Author: User
Tags centos

To improve the security of the server, this lesson is mainly about how to modify the MySQL port under Linux. Support for most system changes in Linux environments, such as CentOS and Ubuntu.

Demo Environment:

Linux CentOS 6.3 X32
Mysql 5.1.66

First, edit my.conf

Vi/etc/my.conf

Second, add port=3506 under [mysqld]

Third, restart the MySQL service

#/etc/init.d/mysqld restart

Tips:
0, 3506 is the port you want to modify;
1. Remember to add the port into the iptables after the modification;
2, updated MySQL port, may have been the site will not be able to connect, remember in the Web site configuration file plus port;
3. If the service cannot be restarted after modification, please check
A, the use of the port will not be occupied?
B, edit/etc/my.conf add [client] port=3506

C, add and then restart the MySQL service

Tips , if you modify the MySQL port, we must be in the program connected to the place you modify the port, some friends do not use the port 3306 connection, but the change must be taken, do not change with the port MySQL default 3306.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.