centos7启动MySQL时候突然进不去Job for mysqld.service failed because the control process exited with error cod

仲孙兴平
2023-12-01

mysql突然进不去了,不知道什魔鬼

[root@localhost ~]# systemctl start mysqld.service

Job for mysqld.service failed because the control process exited with error code. See "sys                                       temctl status mysqld.service" and "journalctl -xe" for details.

根据提示先查看一下,找了好长时间都没找到,百度了一大堆,真能害死人。。。
[root@localhost ~]# journalctl -xe

Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8933] dhcp4
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8942] dhcp4
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8952] dhcp4
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8952] dhcp4
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4
Sep 27 07:05:08 localhost.localdomain dbus-daemon[741]: dbus[741]: [system] Activating via
Sep 27 07:05:08 localhost.localdomain dbus[741]: [system] Activating via systemd: service
Sep 27 07:05:08 localhost.localdomain dhclient[935]: bound to 192.168.146.133 -- renewal i
Sep 27 07:05:09 localhost.localdomain systemd[1]: Starting Network Manager Script Dispatch
-- Subject: Unit NetworkManager-dispatcher.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has begun starting up.
Sep 27 07:05:09 localhost.localdomain dbus-daemon[741]: dbus[741]: [system] Successfully a
Sep 27 07:05:09 localhost.localdomain dbus[741]: [system] Successfully activated service '
Sep 27 07:05:09 localhost.localdomain systemd[1]: Started Network Manager Script Dispatche
-- Subject: Unit NetworkManager-dispatcher.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has finished starting up.
--
-- The start-up result is done.
Sep 27 07:05:09 localhost.localdomain nm-dispatcher[3516]: req:1 'dhcp4-change' [ens33]: n
Sep 27 07:05:09 localhost.localdomain nm-dispatcher[3516]: req:1 'dhcp4-change' [ens33]: s
lines 3173-3200/3200 (END)
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8933] dhcp4 (ens33):   address 1
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8942] dhcp4 (ens33):   plen 24 (
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8952] dhcp4 (ens33):   gateway 1
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8952] dhcp4 (ens33):   lease tim
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4 (ens33):   nameserve
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4 (ens33):   domain na
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4 (ens33): state chang
Sep 27 07:05:08 localhost.localdomain dbus-daemon[741]: dbus[741]: [system] Activating via systemd: service nam
Sep 27 07:05:08 localhost.localdomain dbus[741]: [system] Activating via systemd: service name='org.freedesktop
Sep 27 07:05:08 localhost.localdomain dhclient[935]: bound to 192.168.146.133 -- renewal in 724 seconds.
Sep 27 07:05:09 localhost.localdomain systemd[1]: Starting Network Manager Script Dispatcher Service...
-- Subject: Unit NetworkManager-dispatcher.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has begun starting up.
Sep 27 07:05:09 localhost.localdomain dbus-daemon[741]: dbus[741]: [system] Successfully activated service 'org
Sep 27 07:05:09 localhost.localdomain dbus[741]: [system] Successfully activated service 'org.freedesktop.nm_di
Sep 27 07:05:09 localhost.localdomain systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: Unit NetworkManager-dispatcher.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has finished starting up.
--
-- The start-up result is done.
Sep 27 07:05:09 localhost.localdomain nm-dispatcher[3516]: req:1 'dhcp4-change' [ens33]: new request (4 scripts
Sep 27 07:05:09 localhost.localdomain nm-dispatcher[3516]: req:1 'dhcp4-change' [ens33]: start running ordered
lines 3173-3200/3200 (END)
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8933] dhcp4 (ens33):   address 192.168.14
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8942] dhcp4 (ens33):   plen 24 (255.255.2
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8952] dhcp4 (ens33):   gateway 192.168.14
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8952] dhcp4 (ens33):   lease time 1800
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4 (ens33):   nameserver '192.16
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4 (ens33):   domain name 'local
Sep 27 07:05:08 localhost.localdomain NetworkManager[811]: <info>  [1538046308.8953] dhcp4 (ens33): state changed bound
Sep 27 07:05:08 localhost.localdomain dbus-daemon[741]: dbus[741]: [system] Activating via systemd: service name='org.fr
Sep 27 07:05:08 localhost.localdomain dbus[741]: [system] Activating via systemd: service name='org.freedesktop.nm_dispa
Sep 27 07:05:08 localhost.localdomain dhclient[935]: bound to 192.168.146.133 -- renewal in 724 seconds.
Sep 27 07:05:09 localhost.localdomain systemd[1]: Starting Network Manager Script Dispatcher Service...
-- Subject: Unit NetworkManager-dispatcher.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has begun starting up.
Sep 27 07:05:09 localhost.localdomain dbus-daemon[741]: dbus[741]: [system] Successfully activated service 'org.freedesk
Sep 27 07:05:09 localhost.localdomain dbus[741]: [system] Successfully activated service 'org.freedesktop.nm_dispatcher'
Sep 27 07:05:09 localhost.localdomain systemd[1]: Started Network Manager Script Dispatcher Service.
-- Subject: Unit NetworkManager-dispatcher.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit NetworkManager-dispatcher.service has finished starting up.
--
-- The start-up result is done.
Sep 27 07:05:09 localhost.localdomain nm-dispatcher[3516]: req:1 'dhcp4-change' [ens33]: new request (4 scripts)
Sep 27 07:05:09 localhost.localdomain nm-dispatcher[3516]: req:1 'dhcp4-change' [ens33]: start running ordered scripts..

[root@localhost ~]# 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 Thu 2018-09-27 07:03:47 EDT; 3min 20s ago
     Docs: man:mysqld(8)
           http://dev.mysql.com/doc/refman/en/using-systemd.html
  Process: 3493 ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS (code=exited, status=1/FAILURE)
  Process: 3468 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
 Main PID: 3493 (code=exited, status=1/FAILURE)
   Status: "SERVER_BOOTING"
    Error: 13 (Permission denied)

Sep 27 07:03:41 localhost.localdomain systemd[1]: Starting MySQL Server...
Sep 27 07:03:47 localhost.localdomain systemd[1]: mysqld.service: main process exited, code=exited, status=1/FAILURE
Sep 27 07:03:47 localhost.localdomain systemd[1]: Failed to start MySQL Server.
Sep 27 07:03:47 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
Sep 27 07:03:47 localhost.localdomain systemd[1]: mysqld.service failed.

实在不行,百度说是查看一下日志,出现can’t create test…什么文件,终于找到了,解决MySQL没有权限问题Can't create test file /var/lib/mysql/localhost.lower-test
执行这条命令,权限问题:
真气人。。。
chown -R mysql:mysql /data/mysql
[root@localhost ~]# cat /var/log/mysqld.log

180616 04:28:59 mysqld_safe Logging to '/var/log/mysqld.log'.
180616 04:28:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2018-06-16 04:28:59 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_         timestamp server option (see documentation for more details).
2018-06-16 04:28:59 0 [Note] /usr/sbin/mysqld (mysqld 5.6.40) starting as process 24325 ...
2018-06-16 04:28:59 24325 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2018-06-16 04:28:59 24325 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

2018-06-16 04:28:59 24325 [Note] Plugin 'FEDERATED' is disabled.
2018-06-16 04:28:59 24325 [Note] InnoDB: Using atomics to ref count buffer pool pages
2018-06-16 04:28:59 24325 [Note] InnoDB: The InnoDB memory heap is disabled
2018-06-16 04:28:59 24325 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2018-06-16 04:28:59 24325 [Note] InnoDB: Memory barrier is not used
2018-06-16 04:28:59 24325 [Note] InnoDB: Compressed tables use zlib 1.2.3
2018-06-16 04:28:59 24325 [Note] InnoDB: Using Linux native AIO
2018-06-16 04:28:59 24325 [Note] InnoDB: Using CPU crc32 instructions
2018-06-16 04:28:59 24325 [Note] InnoDB: Initializing buffer pool, size = 128.0M
2018-06-16 04:28:59 24325 [Note] InnoDB: Completed initialization of buffer pool
2018-06-16 04:28:59 24325 [Note] InnoDB: Highest supported file format is Barracuda.
2018-06-16 04:28:59 24325 [Note] InnoDB: 128 rollback segment(s) are active.
2018-06-16 04:28:59 24325 [Note] InnoDB: Waiting for purge to start
2018-06-16 04:28:59 24325 [Note] InnoDB: 5.6.40 started; log sequence number 1625987
2018-06-16 04:28:59 24325 [Warning] No existing UUID has been found, so we assume that this is the first time that this          server has been started. Generating a new UUID: 516c4ce5-713f-11e8-bffd-000c29f4346c.
2018-06-16 04:28:59 24325 [Note] Server hostname (bind-address): '*'; port: 3306
2018-06-16 04:28:59 24325 [Note] IPv6 is available.
2018-06-16 04:28:59 24325 [Note]   - '::' resolves to '::';
2018-06-16 04:28:59 24325 [Note] Server socket created on IP: '::'.
2018-06-16 04:28:59 24325 [Note] Event Scheduler: Loaded 0 events
2018-06-16 04:28:59 24325 [Note] /usr/sbin/mysqld: ready for connections.
Version: '5.6.40'  socket: '/var/lib/mysql/mysql.sock'  port: 3306  MySQL Community Server (GPL)
180702 04:22:43 mysqld_safe Logging to '/var/log/mysqld.log'.
180702 04:22:44 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
2018-07-02 04:22:44 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_         timestamp server option (see documentation for more details).
2018-07-02 04:22:44 0 [Note] /usr/sbin/mysqld (mysqld 5.6.40) starting as process 1649 ...
2018-07-02 04:22:44 1649 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)

2018-07-02 04:22:44 1649 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 2000)

推荐这位博主MySQL安装详细篇,真的很详细,记录下方便以后查看:https://blog.csdn.net/weixin_42266606/article/details/80879571

 类似资料: