MySql启动的时候:
立即变红!
查看日志如下:
2023-03-04T14:18:01.089671Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
2023-03-04T14:18:10.304169Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.32) starting as process 90802
2023-03-04T14:18:10.305283Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2023-03-04T14:18:10.311468Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-04T14:18:10.348218Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-03-04T14:18:10.402146Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-03-04T14:18:10.402165Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-03-04T14:18:10.402690Z 0 [ERROR] [MY-010270] [Server] Can’t start server : Bind on unix socket: Address already in use
2023-03-04T14:18:10.402705Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
2023-03-04T14:18:10.402716Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-04T14:18:11.426648Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
2023-03-04T14:18:11.634935Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.32) starting as process 90815
2023-03-04T14:18:11.636077Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2023-03-04T14:18:11.641653Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-04T14:18:11.678424Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-03-04T14:18:11.732748Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-03-04T14:18:11.732766Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-03-04T14:18:11.733128Z 0 [ERROR] [MY-010270] [Server] Can’t start server : Bind on unix socket: Address already in use
2023-03-04T14:18:11.733136Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
2023-03-04T14:18:11.733147Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-04T14:18:12.759526Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
2023-03-04T14:18:21.964683Z 0 [System] [MY-010116] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.32) starting as process 90895
2023-03-04T14:18:21.965772Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /usr/local/mysql/data/ is case insensitive
2023-03-04T14:18:21.971112Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started.
2023-03-04T14:18:22.007750Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended.
2023-03-04T14:18:22.062324Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2023-03-04T14:18:22.062343Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2023-03-04T14:18:22.062737Z 0 [ERROR] [MY-010270] [Server] Can’t start server : Bind on unix socket: Address already in use
2023-03-04T14:18:22.062744Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /tmp/mysql.sock ?
2023-03-04T14:18:22.062756Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-03-04T14:18:23.087191Z 0 [System] [MY-010910] [Server] /usr/local/mysql/bin/mysqld: Shutdown complete (mysqld 8.0.32) MySQL Community Server - GPL.
解决方案:
这个错误显示MySQL服务器无法启动,因为另一个mysqld服务器正在使用地址/tmp/mysql.sock。这通常是由于上一次MySQL服务器没有正常关闭而导致的。为解决此问题,您可以尝试以下步骤:
确保所有MySQL服务器进程都已停止。您可以使用以下命令检查:
Copy code
ps -ef | grep mysql
如果有任何MySQL服务器进程在运行,请使用以下命令停止它们:
Copy code
sudo kill -9 <进程ID>
删除MySQL的socket文件/tmp/mysql.sock:
Copy code
sudo rm /tmp/mysql.sock
重新启动MySQL服务器:
Copy code
sudo service mysql start