Job for mysqld.service failed because the control process exited with error code. See “systemctl sta

created at 12-05-2021 views: 680

Start mysql8

systemctl start mysqld.service

error

Job for mysqld.service failed because the control process exited with error code. See “systemctl status mysqld.service” and “journalctl -xe” for details.

Follow the prompts to view

systemctl status mysqld.service
   mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Mon 2020-04-20 06:37:28 EDT; 11s ago
  Process: 17057 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
  Process: 17042 ExecStart=/usr/libexec/mysqld --basedir=/usr (code=exited, status=1/FAILURE)
  Process: 17005 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
  Process: 16980 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 17042 (code=exited, status=1/FAILURE)
   Status: "Data Dictionary upgrade from MySQL 5.7 in progress"
    Error: 2 (No such file or directory)

Apr 20 06:37:26 lsf1p13 systemd[1]: Starting MySQL 8.0 database server...
Apr 20 06:37:27 lsf1p13 systemd[1]: mysqld.service: Main process exited, code=exited, status=1/FAILURE
Apr 20 06:37:28 lsf1p13 systemd[1]: mysqld.service: Failed with result 'exit-code'.
Apr 20 06:37:28 lsf1p13 systemd[1]: Failed to start MySQL 8.0 database server.

solution

If you are root, you can omit steps 1, 2

1. Check permissions: ls -l /var/lib/ | grep mysql

drwxr-xr-x   5 mysql          mysql           270 Apr 20 06:38 mysql
drwxr-x---   2 mysql          mysql             6 Aug  7  2019 mysql-files
drwx------   2 mysql          mysql             6 Aug  7  2019 mysql-keyring

2. If you do not have permission to assign permissions, hmod -R 777 /var/lib/mysql

3. Delete the content under mysql, it can be caused by conflicts, rm -rf /var/lib/mysql/*

4. Start mysql, systemctl start mysqld.service

5. View status:

systemctl statys mysqld.service
Unknown operation statys.
[root@lsf1p13 playbook]# systemctl status mysqld.service
   mysqld.service - MySQL 8.0 database server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; disabled; vendor preset: disabled)
   Active: active (running) since Mon 2020-04-20 06:47:12 EDT; 22s ago
  Process: 17278 ExecStopPost=/usr/libexec/mysql-wait-stop (code=exited, status=0/SUCCESS)
  Process: 17600 ExecStartPost=/usr/libexec/mysql-check-upgrade (code=exited, status=0/SUCCESS)
  Process: 17472 ExecStartPre=/usr/libexec/mysql-prepare-db-dir mysqld.service (code=exited, status=0/SUCCESS)
  Process: 17447 ExecStartPre=/usr/libexec/mysql-check-socket (code=exited, status=0/SUCCESS)
 Main PID: 17558 (mysqld)
   Status: "Server is operational"
    Tasks: 39
   Memory: 593.1M
   CGroup: /system.slice/mysqld.service
           └─17558 /usr/libexec/mysqld --basedir=/usr

Apr 20 06:47:03 lsf1p13 systemd[1]: Starting MySQL 8.0 database server...
Apr 20 06:47:04 lsf1p13 mysql-prepare-db-dir[17472]: Initializing MySQL database
Apr 20 06:47:12 lsf1p13 systemd[1]: Started MySQL 8.0 database server.

After checking, the data under the var/lib/ package are files that needs to be changed when the system is running normally.

Start again and execute successfully

[root@lsf1p13 playbook]# systemctl start mysqld.service
[root@lsf1p13 playbook]# ps -ef | grep mysql
mysql     4248     1  3 09:10 ?        00:00:00 /usr/sbin/mysqld
root      4296  3952  0 09:10 pts/0    00:00:00 grep --color=auto mysql

created at:12-05-2021
edited at: 12-05-2021: