修改mysql端口后重启mysql报错:Can't start server: Bind on TCP/IP port. Got error...n denied

Posted YSHY

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了修改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

以上是关于修改mysql端口后重启mysql报错:Can't start server: Bind on TCP/IP port. Got error...n denied的主要内容,如果未能解决你的问题,请参考以下文章

mysql修改端口后启动失败

修改MySQL端口后重启不了

mysql8 修改my.ini配置 重启服务 报错

mysql报错ERROR 2003 (HY000): Can't connect to MySQL server on 'localhost' (10061)

启动mysql 报错: ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/var/lib

mysql修改默认端口方法