今天早上,我更新了 MySQL,因为有可用的更新,但从那时起,服务就无法启动。
下面是从 systemctl status mysqld.service 输出的屏幕截图 - 错误似乎是“没有这样的文件或目录”,但我可以看到数据......
来自 mysqld.log
2019-04-29T07:52:12.107195Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mo$
2019-04-29T07:52:12.110473Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 7100
2019-04-29T07:52:12.113297Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please$
2019-04-29T07:52:12.113317Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate $
2019-04-29T07:52:19.927908Z 4 [System] [MY-013381] [Server] Server upgrade from '80015' to '80016' started.
2019-04-29T07:52:31.456525Z 4 [System] [MY-013381] [Server] Server upgrade from '80015' to '80016' completed.
2019-04-29T07:52:45.173350Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-04-29T07:52:45.195659Z 0 [ERROR] [MY-010270] [Server] Can't start server : Bind on unix socket: Address already in use
2019-04-29T07:52:45.195686Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
2019-04-29T07:52:45.196385Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-04-29T07:52:47.560115Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16) MySQL Community Server - GPL.
2019-04-29T07:55:48.983870Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mo$
2019-04-29T07:55:48.986909Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 3667
2019-04-29T07:55:49.229362Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please$
2019-04-29T07:55:49.229394Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate $
2019-04-29T07:58:43.922205Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mo$
2019-04-29T07:58:43.924734Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 4362
2019-04-29T07:58:43.927787Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please$
2019-04-29T07:58:43.927807Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate $
2019-04-29T07:58:45.734055Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-04-29T07:58:45.739086Z 0 [ERROR] [MY-010270] [Server] Can't start server : Bind on unix socket: Address already in use
2019-04-29T07:58:45.739110Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
2019-04-29T07:58:45.739676Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-04-29T07:58:47.828539Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16) MySQL Community Server - GPL.
2019-04-29T08:21:45.104646Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mo$
2019-04-29T08:21:45.108410Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.16) starting as process 4826
2019-04-29T08:21:45.111420Z 0 [Warning] [MY-013242] [Server] --character-set-server: 'utf8' is currently an alias for the character set UTF8MB3, but will be an alias for UTF8MB4 in a future release. Please$
2019-04-29T08:21:45.111440Z 0 [Warning] [MY-013244] [Server] --collation-server: 'utf8_general_ci' is a collation of the deprecated character set UTF8MB3. Please consider using UTF8MB4 with an appropriate $
2019-04-29T08:21:49.874453Z 0 [Warning] [MY-010068] [Server] CA certificate ca.pem is self signed.
2019-04-29T08:21:49.891328Z 0 [ERROR] [MY-010270] [Server] Can't start server : Bind on unix socket: Address already in use
2019-04-29T08:21:49.891353Z 0 [ERROR] [MY-010258] [Server] Do you already have another mysqld server running on socket: /var/lib/mysql/mysql.sock ?
2019-04-29T08:21:49.892014Z 0 [ERROR] [MY-010119] [Server] Aborting
2019-04-29T08:21:52.722060Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.16) MySQL Community Server - GPL.
我尝试卸载更新(但在 mysqld.log 中发现一行显示“降级不可用”。我尝试按照另一个论坛中的建议删除 ib_logfile0 和 ib_logfile1。
请帮忙...
编辑:
我已经尝试过解决方案MySQL PID 文件丢失(因为我看不到 pid 文件),所以:
chmod 0777 /var/lib/mysql/ib_logfile0
chmod 0777 /var/lib/mysql/ib_logfile1
chown -R mysql:root /var/lib/mysql
错误已改变 - 以下是 systemctl status mysqld.service 的更新输出
[root@360loa5 mysql]# systemctl status mysqld.service
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Mon 2019-04-29 09:21:52 BST; 7min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 4826 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 4807 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 4826 (code=exited, status=1/FAILURE)
Status: "SERVER_BOOTING"
Error: 98 (Address already in use)
Apr 29 09:21:44 360loa5.360ss.com systemd[1]: Starting MySQL Server...
Apr 29 09:21:52 360loa5.360ss.com systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Apr 29 09:21:52 360loa5.360ss.com systemd[1]: Failed to start MySQL Server.
Apr 29 09:21:52 360loa5.360ss.com systemd[1]: Unit mysqld.service entered failed state.
Apr 29 09:21:52 360loa5.360ss.com systemd[1]: mysqld.service failed.
在输出中
sudo netstat -lntup
端口 3306 没有列出任何内容...
答案1
最终,解决办法如下:
mv /var/lib/mysql/mysql.sock /var/lib/mysql/mysql.sock.bak
答案2
这是常见问题,您可以修改 MySQL 启动脚本以打印“pid 文件”是否存在,并在启动 MySQL 之前清除它。当您看到如下错误时,这意味着端口/资源已被使用。
Error: 98 (Address already in use)