解决linux(centos7)重新安装mysql systemctl start mysqld.service时报错

重新安装mysql时,运行

systemctl status mysqld.service
报错。

[root@test-dcruxue ~]# systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
查看mysql服务状态

[root@test-dcruxue ~]# 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 Tue 2018-07-17 16:14:22 CST; 8min ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 17451 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 17376 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 16428 (code=exited, status=1/FAILURE)

Jul 17 16:13:41 test-dcruxue systemd[1]: Starting MySQL Server...
Jul 17 16:14:20 test-dcruxue mysqld[17451]: Initialization of mysqld failed: 0
Jul 17 16:14:20 test-dcruxue systemd[1]: mysqld.service: control process exited, code=exited status=1
Jul 17 16:14:22 test-dcruxue systemd[1]: Failed to start MySQL Server.
Jul 17 16:14:22 test-dcruxue systemd[1]: Unit mysqld.service entered failed state.
Jul 17 16:14:22 test-dcruxue systemd[1]: mysqld.service failed.
无果;

遂想到查看日志:cat /var/log/mysqld.log

2018-07-17T08:23:01.745601Z 0 [ERROR] Can't start server: Bind on TCP/IP port: Address already in use
2018-07-17T08:23:01.745607Z 0 [ERROR] Do you already have another mysqld server running on port: 3306 ?
2018-07-17T08:23:01.745619Z 0 [ERROR] Aborting
发现3306端口被占用

[root@test-dcruxue ~]# ps aux|grep mysql
root 9861 0.0 0.0 113252 1600 ? S 14:52 0:00 /bin/sh /usr/bin/mysqld_safe --skip-grant-table
mysql 10009 0.0 5.6 1585376 457120 ? Sl 14:52 0:03 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --user=mysql --skip-grant-table --log-error=/var/log/mysqld.log --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/mysql.sock
root 17563 0.0 0.0 112648 956 pts/2 R+ 16:32 0:00 grep --color=auto mysql
然后杀掉进程

[root@test-dcruxue ~]# kill -9 10009
就ok了
————————————————

 

聚焦技术与人文,分享干货,共同成长更多内容请关注“数据与人”

posted on   数据与人文  阅读(7298)  评论(0编辑  收藏  举报

编辑推荐:
· [.NET]调用本地 Deepseek 模型
· 一个费力不讨好的项目,让我损失了近一半的绩效!
· .NET Core 托管堆内存泄露/CPU异常的常见思路
· PostgreSQL 和 SQL Server 在统计信息维护中的关键差异
· C++代码改造为UTF-8编码问题的总结
阅读排行:
· 【.NET】调用本地 Deepseek 模型
· CSnakes vs Python.NET:高效嵌入与灵活互通的跨语言方案对比
· DeepSeek “源神”启动!「GitHub 热点速览」
· 我与微信审核的“相爱相杀”看个人小程序副业
· Plotly.NET 一个为 .NET 打造的强大开源交互式图表库
< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示