码迷,mamicode.com
首页 > 数据库 > 详细

修改MySQL端口后重启不了

时间:2018-04-02 20:21:24      阅读:210      评论:0      收藏:0      [点我收藏+]

标签:size   for   bsp   links   root   重启   read   /etc   inno   

 

修改MySQL端口为13306

vim /etc/my.cnf

[mysqld]
port=13306
lower_case_table_names=1

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

 

/etc/init.d/mysqld start
MySQL Daemon failed to start.
Starting mysqld:       [FAILED]

日志报错

180402 13:07:25 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended
180402 13:13:19 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
180402 13:13:19 InnoDB: Initializing buffer pool, size = 8.0M
180402 13:13:19 InnoDB: Completed initialization of buffer pool
180402 13:13:19 InnoDB: Started; log sequence number 0 44233
180402 13:13:19 [ERROR] Can‘t start server: Bind on TCP/IP port: Permission denied
180402 13:13:19 [ERROR] Do you already have another mysqld server running on port: 13306 ?
180402 13:13:19 [ERROR] Aborting

180402 13:13:19 InnoDB: Starting shutdown...
180402 13:13:24 InnoDB: Shutdown completed; log sequence number 0 44233
180402 13:13:24 [Note] /usr/libexec/mysqld: Shutdown complete

1.解决办法

vim /etc/sysconfig/iptables

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

 第一种方法是开放外网端口,第二种方式用于本地启动;

不写防火墙策略,无法远程访问数据库

2.关闭 SELinux问题

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

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

SELINUX=disabled

修改MySQL端口后重启不了

标签:size   for   bsp   links   root   重启   read   /etc   inno   

原文地址:https://www.cnblogs.com/macupdate/p/8695816.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!