Tag Archives: MySQL startup error

[Solved] MySQL Startup Error: Job for mysqld.service failed because the control process exited with error code

Question

An error is reported when starting MySQL service, as shown below:

[root@node2 hadoop]# 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.

or

[root@node2 hadoop]# 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.

Solution

This is because the /var/lib/MySQL directory has insufficient permissions

[root@node2 hadoop]# cd /var/lib/mysql
[root@node2 mysql]# ll
all 167348
-rw-r-----. 1 root  root        56 6月  19 20:00  auto.cnf
-rw-r-----. 1 mysql mysql        0 6月  19 20:01  binlog.index
-rw-------. 1 root  root      1676 6月  19 20:00  ca-key.pem
-rw-r--r--. 1 root  root      1112 6月  19 20:00  ca.pem
-rw-r--r--. 1 root  root      1112 6月  19 20:00  client-cert.pem
-rw-------. 1 root  root      1676 6月  19 20:00  client-key.pem
-rw-r-----. 1 root  root    196608 6月  19 20:00 '#ib_16384_0.dblwr'
-rw-r-----. 1 root  root   8585216 6月  19 20:00 '#ib_16384_1.dblwr'
-rw-r-----. 1 root  root      3595 6月  19 20:00  ib_buffer_pool
-rw-r-----. 1 root  root  12582912 6月  19 20:00  ibdata1
-rw-r-----. 1 root  root  50331648 6月  19 20:00  ib_logfile0
-rw-r-----. 1 root  root  50331648 6月  19 20:00  ib_logfile1
drwxr-x---. 2 root  root         6 6月  19 20:00 '#innodb_temp'
drwxr-x---. 2 root  root         6 6月  19 20:00  mysql
-rw-r-----. 1 root  root  15728640 6月  19 20:00  mysql.ibd
drwxr-x---. 2 root  root      8192 6月  19 20:00  performance_schema
-rw-------. 1 root  root      1676 6月  19 20:00  private_key.pem
-rw-r--r--. 1 root  root       452 6月  19 20:00  public_key.pem
-rw-r--r--. 1 root  root      1112 6月  19 20:00  server-cert.pem
-rw-------. 1 root  root      1676 6月  19 20:00  server-key.pem
-rw-r-----. 1 root  root  16777216 6月  19 20:00  undo_001
-rw-r-----. 1 root  root  16777216 6月  19 20:00  undo_002

Modify permissions and start MySQL

[root@node2 ~]# setenforce 0 
[root@node2 ~]# chown -R mysql:mysql /var/lib/mysql
[root@node2 ~]# chmod -R 777 /var/lib/mysql
[root@node2 ~]# systemctl start mysqld.service
[root@node2 ~]# ps -ef |grep mysql
mysql      26627       1  4 23:57 ?       00:00:00 /usr/sbin/mysqld
root       26671   10438  0 23:57 pts/0    00:00:00 grep --color=auto mysql
[root@node2 ~]# cd /var/lib/mysql
[root@node2 mysql]# ll
all 190916
-rw-r-----. 1 mysql mysql       56 6月  19 23:57  auto.cnf
-rw-r-----. 1 mysql mysql      156 6月  19 23:57  binlog.000001
-rw-r-----. 1 mysql mysql       16 6月  19 23:57  binlog.index
-rwxrwxrwx. 1 mysql mysql     1680 6月  19 23:50  ca-key.pem
-rwxrwxrwx. 1 mysql mysql     1112 6月  19 23:50  ca.pem
-rwxrwxrwx. 1 mysql mysql     1112 6月  19 23:50  client-cert.pem
-rwxrwxrwx. 1 mysql mysql     1676 6月  19 23:50  client-key.pem
-rwxrwxrwx. 1 mysql mysql   196608 6月  19 23:57 '#ib_16384_0.dblwr'
-rwxrwxrwx. 1 mysql mysql  8585216 6月  19 23:50 '#ib_16384_1.dblwr'
-rwxrwxrwx. 1 mysql mysql     6059 6月  19 23:50  ib_buffer_pool
-rwxrwxrwx. 1 mysql mysql 12582912 6月  19 23:57  ibdata1
-rwxrwxrwx. 1 mysql mysql 50331648 6月  19 23:57  ib_logfile0
-rwxrwxrwx. 1 mysql mysql 50331648 6月  19 23:50  ib_logfile1
-rw-r-----. 1 mysql mysql 12582912 6月  19 23:57  ibtmp1
drwxrwxrwx. 2 mysql mysql      187 6月  19 23:57 '#innodb_temp'
drwxrwxrwx. 2 mysql mysql      143 6月  19 23:50  mysql
-rwxrwxrwx. 1 mysql mysql 27262976 6月  19 23:57  mysql.ibd
srwxrwxrwx. 1 mysql mysql        0 6月  19 23:57  mysql.sock
-rw-------. 1 mysql mysql        6 6月  19 23:57  mysql.sock.lock
drwxrwxrwx. 2 mysql mysql     8192 6月  19 23:50  performance_schema
-rwxrwxrwx. 1 mysql mysql     1676 6月  19 23:50  private_key.pem
-rwxrwxrwx. 1 mysql mysql      452 6月  19 23:50  public_key.pem
-rwxrwxrwx. 1 mysql mysql     1112 6月  19 23:50  server-cert.pem
-rwxrwxrwx. 1 mysql mysql     1680 6月  19 23:50  server-key.pem
drwxrwxrwx. 2 mysql mysql       28 6月  19 23:50  sys
-rwxrwxrwx. 1 mysql mysql 16777216 6月  19 23:57  undo_001
-rwxrwxrwx. 1 mysql mysql 16777216 6月  19 23:57  undo_002
[root@node2 mysql]# 

Note:

  1. Setenforce 0 is used to solve [InnoDB] Operating system error number 13 in a file operation.
  2. Directory permissions must be set to 777, just 755 will also cause an error

MySQL startup error: vcruntime140_1.dll cannot be found, unable to continue code execution

Build a MySQL development environment under Windows environment and report an error when executing mysqld. The error content is:

Vcruntime140 not found_ 1.dll, unable to continue code execution

The reason is that there is no vcruntime140_1.DLL file under C:\Windows\System32 of windows.

Solution: Download vcruntime140_1.dll from the official Website and put it in C:\Windows\System32.

MySQL Error: [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file

In the environment with Wamp installed locally, MySQL fails to start at startup. Check the startup failure log as follows:

2021-08-21T12:46:57.183482Z 0 [ERROR] [FATAL] InnoDB: Table flags are 0 in the data dictionary but the flags in file .\ibdata1 are 0x4800!
2021-08-21 20:46:57 0xf48  InnoDB: Assertion failure in thread 3912 in file ut0ut.cc line 942
InnoDB: We intentionally generate a memory trap.
InnoDB: Submit a detailed bug report to http://bugs.mysql.com.
InnoDB: If you get repeated assertion failures or crashes, even
InnoDB: immediately after the mysqld startup, there may be
InnoDB: corruption in the InnoDB tablespace. Please refer to
InnoDB: http://dev.mysql.com/doc/refman/5.7/en/forcing-innodb-recovery.html
InnoDB: about forcing recovery.
12:46:57 UTC - mysqld got exception 0x80000003 ;
This could be because you hit a bug. It is also possible that this binary
or one of the libraries it was linked against is corrupt, improperly built,
or misconfigured. This error can also be caused by malfunctioning hardware.
Attempting to collect some information that could help diagnose the problem.
As this is a crash and something is definitely wrong, the information
collection process might fail.

Later, after checking online, many people reported this problem after using MySQL 8 and then MySQL 5.7, and then this is the case in my local area. Later, I checked the my.ini file and found that there was a problem with the directory pointing to the configuration dataDir. Just modify it.

Then start again and report the following error:

2021-08-21T12:57:29.873841Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2021-08-21T12:57:29.874698Z 0 [ERROR] InnoDB: The innodb_system data file 'ibdata1' must be writable
2021-08-21T12:57:29.875239Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2021-08-21T12:57:30.090440Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2021-08-21T12:57:30.091251Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2021-08-21T12:57:30.091811Z 0 [ERROR] Failed to initialize builtin plugins.
2021-08-21T12:57:30.092185Z 0 [ERROR] Aborting

Then delete the IB in the data directory under the MySQL installation directory according to the online method_logfile0 and IB_logfile1. If these two files cannot be deleted, find mysqld in the process list and end it.