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

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了解决linux(centos7)重新安装mysql systemctl start mysqld.service时报错相关的知识,希望对你有一定的参考价值。

参考技术A 重新安装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了

centos7 Linux 安装mysql

安装过程如:

http://blog.csdn.net/tengdazhang770960436/article/details/18361979

中间过程出现无法安装mysql-server

解决方法:http://www.centoscn.com/CentosBug/osbug/2016/0111/6643.html。

 

以上是关于解决linux(centos7)重新安装mysql systemctl start mysqld.service时报错的主要内容,如果未能解决你的问题,请参考以下文章

centos7 Linux 安装mysql

mysql安装 demo [linux centos7] [5.7.26]

Linux下重新安装MySql后出现'MySQL Daemon failed to start‘解决方法

CentOS7初始化mysql库报错

linux 安装mysql

Centos7安装完毕后重启提示Initial setup of CentOS Linux 7 (core)的解决方法