Jobformysqld.servicefailedbecausethecontrolpr。。。启动MySQL时抛出:
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
提⽰说使⽤journalctl -xe查看详细⽇志
[linga@localhost ~]$ journalctl -xe
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: /mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
Aug 30 04:32:12 localhost.localdomain mysqld[2312]: Initialization of mysqld failed: 0
mysql下载starting the serverAug 30 04:32:12 localhost.localdomain systemd[1]: mysqld.service: control process exited, code=exited status=1
Aug 30 04:32:14 localhost.localdomain systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: /mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Aug 30 04:32:14 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
Aug 30 04:32:14 localhost.localdomain systemd[1]: mysqld.service failed.
Aug 30 04:32:14 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
Aug 30 04:32:14 localhost.localdomain systemd[1]: Starting
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: /mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
Aug 30 04:32:14 localhost.localdomain mysqld[2359]: Initialization of mysqld failed: 0
Aug 30 04:32:14 localhost.localdomain systemd[1]: mysqld.service: control process exited, code=exited status=1
Aug 30 04:32:16 localhost.localdomain systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: /mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
Aug 30 04:32:16 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
Aug 30 04:32:16 localhost.localdomain systemd[1]: mysqld.service failed.
发现时进程已经存在了,MySQL的进程pid是3306,于是想着杀掉该进程:
kill 3306
发现报错了,于是在cat /etc/my.cfg中查看配置
最后发现设置字体编码时弄错配置了,导致启动失败的;
[linga@localhost ~]$ kill 3306
-bash: kill: (3306) - No such process
[linga@localhost ~]$ cat /etc/myf
# For advice on how to change settings please see
# sql/doc/refman/5.7/en/server-configuration-defaults.html
[mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at 70% of total RAM for dedicated server, else 10%.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
# Add UTF-8
character_set=utf8
init_connect='SET NAMES utf8'
[linga@localhost ~]$ sudo vim /etc/myf
[sudo] password for linga:
[linga@localhost ~]$ sudo systemctl start mysqld
[linga@localhost ~]$ sudo systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2018-08-30 04:41:33 EDT; 12s ago
Docs: man:mysqld(8)
sql/doc/refman/en/using-systemd.html
Process: 14018 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=0/SUCCESS) Process: 14001 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 14021 (mysqld)
CGroup: /system.slice/mysqld.service
└─14021 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
Aug 30 04:41:32 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
Aug 30 04:41:32 localhost.localdomain systemd[1]: Starting
Aug 30 04:41:33 localhost.localdomain systemd[1]: Started MySQL Server.
启动失败⼤多都是由于配置⽂件配置出错了才启动不起来,⼀定要提前备份好配置⽂件
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。
发表评论