[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.