Modify the MySQL port and the problems that occur

Source: Internet
Author: User

In order to improve the security of the server, this lesson is mainly about how to modify the MySQL port under Linux. Support most system modifications in Linux environment, such as CentOS and Ubuntu.


First, the editor my.cnf

Vi/etc/my.cnf

Second, add the port=3506 under [mysqld]


Third, restart the MySQL service

Service mysqld Restart


Here I have a problem before, after modifying the port causes the MySQL to not be possible to troubleshoot the following

This is the log of startup failures that have been picked in/var/log/mysqld.log after the port is changed:

130823 17:21:14 Mysqld_safe starting mysqld daemon with databases From/var/lib/mysql
130823 17:21:14 [Warning] '--def Ault-character-set ' is deprecated and would be removed in a future release. Please use '--character-set-server ' instead.
130823 17:21:14  innodb:initializing buffer pool, size = 8.0M
130823 17:21:14  innodb:completed Initial ization of buffer pool
130823 17:21:14  innodb:started; log sequence number 0 44233
130823 17:21:14 [ERROR] Ca N ' t start server:bind on TCP/IP port:permission denied
130823 17:21:14 [ERROR] Do you already has another mysqld Ser Ver running on port:8060?
130823 17:21:14 [ERROR] aborting

130823 17:21:14 innodb:starting shutdown ...
130823 17:21:19 Innodb:shutdown completed; Log sequence number 0 44233
130823 17:21:19 [Note]/usr/libexec/mysqld:shutdown complete

Resolved as follows:

1. Firewall issues

Vi/etc/sysconfig/iptables

Add the following line:

-A input-m state--state new-m tcp-p TCP--dport 8060-j ACCEPT

2. SELinux issues

Method One: Do not need to restart Linux:
[Email protected] ~]# Setenforce 0


Method Two: Need to restart Linux:
Vi/etc/selinux/config

Selinux=disabled

Hint, if you change the MySQL port, we must be in the program connection where you change the port, some friends are accustomed not to use the port 3306 connection, but changed it must be brought, do not change the port MySQL default 3306.


This article from "12666595" blog, declined reprint!

Modify the MySQL port and the problems that occur

Related Article

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.