修改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:
[[email protected] ~]# setenforce 0
方法二:需要重启Linux:
vi /etc/selinux/config
SELINUX=disabled