问题:Starting mysqld (via systemctl): Job for mysqld.service failed. See ‘systemctl status mysqld.service’ and ‘journalctl -xn’ for details.[FAILED]
解决思路:
使用systemctl status mysqld.service和journalctl -xe查看服务启动失败的原因
systemctl status mysqld.service
journalctl -xe发现:以上两条命令不能解决问题,直接通过查看日志,这个方法基本能看出所有问题
#cat /var/log/mysqld.log
//warning和note不用管,直接看error
“`2018-08-21T12:41:21.480445Z 0 [ERROR] Can’t start server: Bind on TCP/IP port: Address already in use
2018-08-21T12:41:21.480449Z 0 [ERROR] Do you already have another mysqld server running on port: 3306意思是端口占用,有嫌疑的端口是3306
# ps -aux | grep mysql
//查看mysqld服务的端口
一堆东西,显示没什么异常
# netstat -apn | grep 3306
//直接看3306对应端口的情况
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 2896/mysqld
找到问题
[root@IM2_JH_OTT mysql-5.7.16]# kill 2896
[root@IM2_JH_OTT mysql-5.7.16]# service mysqld restart
把占用端口的服务2896kill掉再重启,问题得以解决。