赞
踩
运行systemctl start mysqld.service
结果失败退出,屏幕显示信息如下:
用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 Wed 2022-03-02 02:36:30 UTC; 34s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 45163 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 45074 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 45163 (code=exited, status=1/FAILURE)
Status: "Server startup in progress"
Error: 98 (Address already in use)
Mar 02 02:36:11 loaclhost systemd[1]: Starting MySQL Server...
Mar 02 02:36:30 loaclhost systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Mar 02 02:36:30 loaclhost systemd[1]: Failed to start MySQL Server.
Mar 02 02:36:30 loaclhost systemd[1]: Unit mysqld.service entered failed state.
Mar 02 02:36:30 loaclhost systemd[1]: mysqld.service failed.
另外一个命令journalctl -xe也看不到什么有用得信息
这时候需要去查看mysql的启动日志
vi /var/log/mysqld.log
日志里面会记录具体的ERROR,我的ERROR 信息如下:
2022-03-02T02:44:10.470855Z 0 [System] [MY-013602] [Server] Channel mysql_main configured to support TLS. Encrypted connections are now supported for this channel.
2022-03-02T02:44:10.471383Z 0 [ERROR] [MY-010262] [Server] Can't start server: Bind on TCP/IP port: Address already in use
2022-03-02T02:44:10.471415Z 0 [ERROR] [MY-010257] [Server] Do you already have another mysqld server running on port: 3306 ?
2022-03-02T02:44:10.471773Z 0 [ERROR] [MY-010119] [Server] Aborting
因为我的机器上已经启动了另一个docker安装的mysql,所以端口号被占用了。
查看端口号的
lsof -i : 3306
这时需要在mysql的启动配置文件里修改mysql的端口号
vi /etc/my.cnf
添加 port=2022
重洗启动mysql,启动成功。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。