centos mysql 修改端口

本文介绍在CentOS系统中使用yum安装MySQL后,如何正确地修改MySQL的服务端口,包括解决因防火墙和SELinux导致的启动失败问题。

http://blog.youkuaiyun.com/wobin/article/details/10266165

在CentOS上使用yum命令安装mysql后,使用默认端口3306能成功启动,但在/etc/my.cnf里更改端口,mysql启动不成功,后查阅相关资料总结如下:

这是更改端口后,进入/var/log/mysqld.log里摘取的启动失败相关日志:

130823 17:21:14 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
130823 17:21:14 [Warning] '--default-character-set' is deprecated and will 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 initialization of buffer pool
130823 17:21:14  InnoDB: Started; log sequence number 0 44233
130823 17:21:14 [ERROR] Can't start server: Bind on TCP/IP port: Permission denied
130823 17:21:14 [ERROR] Do you already have another mysqld server 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

 

解决如下:

1.  防火墙问题

vi /etc/sysconfig/iptables

添加如下行:

-A INPUT -m state --state NEW -m tcp -p tcp --dport 8060 -j ACCEPT

 

2. SELinux问题

方法一: 不需要重启Linux:
 [root@dytl05 ~]# setenforce 0


 方法二:需要重启Linux:
vi /etc/selinux/config

SELINUX=disabled

转载于:https://www.cnblogs.com/MDK-L/p/4494821.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值