No process is using /var/lib/mysql/mysql.sock, which means it is a garbage, so it will be removed au

  报错信息:

[root@nginx2 ~]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code.
See "systemctl status mysqld.service" and "journalctl -xeu mysqld.service" for details.
[root@nginx2 ~]# systemctl status mysqld.service
× mysqld.service - MySQL 8.0 database server
     Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
     Active: failed (Result: exit-code) since Tue 2024-09-10 12:09:27 CST; 12s ago
    Process: 1668 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
    Process: 1691 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
    Process: 1726 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)
    Process: 1767 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
   Main PID: 1726 (code=exited, status=1/FAILURE)
     Status: "Server shutdown complete"
      Error: 17 (File exists)

Sep 10 12:09:20 nginx2 systemd[1]: Starting MySQL 8.0 database server...
Sep 10 12:09:20 nginx2 mysql-check-socket[1668]: Socket file /var/lib/mysql/mysql.sock exists.
Sep 10 12:09:20 nginx2 mysql-check-socket[1668]: No process is using /var/lib/mysql/mysql.sock, which means it is a garbage, so it will be removed automatically.
Sep 10 12:09:26 nginx2 systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Sep 10 12:09:27 nginx2 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Sep 10 12:09:27 nginx2 systemd[1]: Failed to start MySQL 8.0 database server.

查看mysql进程

[root@nginx2 ~]# ps -aux | grep mysql
root        1803  0.0  0.5  21964  2276 pts/0    S+   12:10   0:00 grep --color=auto mysql

 使用kill命令尝试杀死进程

[root@nginx2 ~]# kill -9 1803
-bash: kill: (1821) - No such process

 查看mysql日志

[root@nginx2 ~]# sudo tail -n 50 /var/log/mysql/mysqld.log 
2024-09-08T03:22:50.069758Z 0 [System] [MY-011323] [Server] X Plugin ready for connections. Bind-address: '::' port: 33060, socket: /var/lib/mysql/mysqlx.sock
2024-09-08T03:26:34.910354Z 9 [Warning] [MY-010055] [Server] IP address '192.168.58.1' could not be resolved: Name or service not known
2024-09-10T04:09:22.413240Z 0 [System] [MY-010116] [Server] /usr/libexec/mysqld (mysqld 8.0.38) starting as process 1726
2024-09-10T04:09:22.616240Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2024-09-10T04:09:24.248123Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2024-09-10T04:09:24.702130Z 0 [ERROR] [MY-011300] [Server] Plugin mysqlx reported: 'Setup of socket: '/var/lib/mysql/mysqlx.sock' failed, another process with PID 1732 is using UNIX socket file'
2024-09-10T04:09:24.726310Z 0 [System] [MY-010229] [Server] Starting XA crash recovery...
2024-09-10T04:09:24.823570Z 0 [System] [MY-010232] [Server] XA crash recovery finished.
2024-09-10T04:09:25.024697Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2024-09-10T04:09:25.024792Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2024-09-10T04:09:25.026379Z 0 [ERROR] [MY-010259] [Server] Another process with pid 1732 is using unix socket file.
2024-09-10T04:09:25.026407Z 0 [ERROR] [MY-010268] [Server] Unable to setup unix socket lock file.
2024-09-10T04:09:25.026438Z 0 [ERROR] [MY-010119] [Server] Aborting
2024-09-10T04:09:26.694976Z 0 [System] [MY-010910] [Server] /usr/libexec/mysqld: Shutdown complete (mysqld 8.0.38)  Source distribution.

 删除冲突的 socket 文件,重启mysql服务:

[root@nginx2 ~]# sudo rm -f /var/lib/mysql/mysqlx.sock
[root@nginx2 ~]# systemctl start mysqld

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

元气满满的热码式

感谢您的支持!我会继续努力发布

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值