修改mysql端口后重启mysql报错:Can't start server: Bind on TCP/IP port. Got error...n denied
1:错误信息:如下
[root@host ~]# systemctl status mariadb ● mariadb.service - MariaDB 10.2.30 database server Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; vendor preset: disabled) Drop-In: /etc/systemd/system/mariadb.service.d └─migrated-from-my.cnf-settings.conf Active: failed (Result: exit-code) since Fri 2019-12-13 09:06:20 CST; 1min 16s ago Docs: man:mysqld(8) https://mariadb.com/kb/en/library/systemd/ Process: 22950 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS --basedir=/usr $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION (code=exited, status=1/FAILURE) Process: 22923 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`/usr/bin/galera_recovery`; [ $? -eq 0 ] && systemctl set-environment _WSREP_START_POSITION=$VAR || exit 1 (code=exited, status=0/SUCCESS) Process: 22921 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS) Main PID: 22950 (code=exited, status=1/FAILURE) Status: "MariaDB server is down" Dec 13 09:06:19 host-10-3-6-39 mysqld[22950]: 2019-12-13 9:06:19 139835293538048 [Note] InnoDB: Buffer pool(s) load completed at 191213 9:06:19 Dec 13 09:06:19 host-10-3-6-39 mysqld[22950]: 2019-12-13 9:06:19 139836014606464 [Note] Plugin 'FEEDBACK' is disabled. Dec 13 09:06:19 host-10-3-6-39 mysqld[22950]: 2019-12-13 9:06:19 139836014606464 [Note] Server socket created on IP: '::'. Dec 13 09:06:19 host-10-3-6-39 mysqld[22950]: 2019-12-13 9:06:19 139836014606464 [ERROR] 1 Dec 13 09:06:19 host-10-3-6-39 mysqld[22950]: 2019-12-13 9:06:19 139836014606464 [ERROR] Do you already have another mysqld server running ...: 3366 ? Dec 13 09:06:19 host-10-3-6-39 mysqld[22950]: 2019-12-13 9:06:19 139836014606464 [ERROR] Aborting Dec 13 09:06:20 host-10-3-6-39 systemd[1]: mariadb.service: main process exited, code=exited, status=1/FAILURE Dec 13 09:06:20 host-10-3-6-39 systemd[1]: Failed to start MariaDB 10.2.30 database server. Dec 13 09:06:20 host-10-3-6-39 systemd[1]: Unit mariadb.service entered failed state. Dec 13 09:06:20 host-10-3-6-39 systemd[1]: mariadb.service failed. Hint: Some lines were ellipsized, use -l to show in full.
2:解决方法
修改mysql端口后需要修改: vi /etc/selinux/config
SELINUX=disabled
然后重启服务。
可以用命令:setenforce 0 临时关闭selinux ,不用重启服务器;
setenforce 0
systemctl restart mariadb