Loading... # 引言 近期审计,要修改端口号和创建新用户,修改配置还算easy,但是启动服务时出了点小插曲。 # 报错信息 ```bash [root@localhost etc]# service mysqld start Redirecting to /bin/systemctl start mysqld.service Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details. ``` 查看日志: ```bash 2022-05-06T07:56:18.269327Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.20) starting as process 13710 2022-05-06T07:56:19.384557Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2022-05-06T07:57:35.667222Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 2022-05-06T07:57:40.236386Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Socket: '/var/run/mysqld/mysqlx.sock' bind-address: '::' port: 33060 2022-05-06T07:57:41.244409Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed. 2022-05-06T07:57:41.539785Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Permission denied 2022-05-06T07:57:41.540043Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 8306 ? 2022-05-06T07:57:41.540718Z 0 [ERROR] [MY-010119] [Server] Aborting 2022-05-06T07:57:42.671388Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.20) MySQL Community Server - GPL. 2022-05-06T08:00:06.677544Z 0 [Warning] [MY-010097] [Server] Insecure configuration for --secure-file-priv: Current value does not restrict location of generated files. Consider setting it to a valid, non-empty path. ``` # 思路 根据报错信息Do you already have another mysqld server running on port: 8306 ?,难道8306端口被其它程序占用了? ```bash netstat -ano | grep 8306 ``` 结果什么也没有 # 问问度娘吧 最后关闭了selinux就好了。 # 关闭selinux ``` setenforce 0 ``` # selinux 日志 ```bash [root@localhost etc]# cat /var/log/audit/audit.log | grep 8306 type=CRYPTO_SESSION msg=audit(1651204525.729:8306): pid=30829 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:sshd_t:s0-s0:c0.c1023 msg='op=start direction=from-client cipher=aes256-ctr ksize=256 mac=hmac-sha2-256 pfs=curve25519-sha256@libssh.org spid=30830 suid=74 rport=62734 laddr=172.16.7.111 lport=22 exe="/usr/sbin/sshd" hostname=? addr=192.168.1.98 terminal=? res=success' type=AVC msg=audit(1651823861.538:12798): avc: denied { name_bind } for pid=13710 comm="mysqld" src=8306 scontext=system_u:system_r:mysqld_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket type=AVC msg=audit(1651824089.379:12812): avc: denied { name_bind } for pid=14338 comm="mysqld" src=8306 scontext=system_u:system_r:mysqld_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket type=AVC msg=audit(1651824279.466:12817): avc: denied { name_bind } for pid=14909 comm="mysqld" src=8306 scontext=system_u:system_r:mysqld_t:s0 tcontext=system_u:object_r:unreserved_port_t:s0 tclass=tcp_socket ``` 通过日志可以看出被拒绝开放8306这个端口了 © 允许规范转载 打赏 赞赏作者 支付宝微信 赞 如果觉得我的文章对你有用,请随意赞赏