Start mysql to report errors:
[root@localhost ~]# systemctl start mysqld
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.
There are three ways to view error messages:
1. systemctl status mysqld.service
[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: start-limit) since 六 2020-03-14 03:55:06 CST; 14s ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 73992 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Process: 73975 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Main PID: 72217 (code=exited, status=0/SUCCESS)
3月 14 03:55:06 localhost.localdomain systemd[1]: Failed to start MySQL Server.
3月 14 03:55:06 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service failed.
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
3月 14 03:55:06 localhost.localdomain systemd[1]: Stopped MySQL Server.
3月 14 03:55:06 localhost.localdomain systemd[1]: start request repeated too quickly for mysqld.service
3月 14 03:55:06 localhost.localdomain systemd[1]: Failed to start MySQL Server.
3月 14 03:55:06 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service failed.
2. journalctl -xe
[root@localhost ~]# journalctl -xe
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
3月 14 03:55:04 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
3月 14 03:55:04 localhost.localdomain systemd[1]: mysqld.service failed.
3月 14 03:55:05 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
3月 14 03:55:05 localhost.localdomain systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has finished shutting down.
3月 14 03:55:05 localhost.localdomain systemd[1]: Starting MySQL Server...
-- Subject: Unit mysqld.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has begun starting up.
3月 14 03:55:06 localhost.localdomain mysqld[73992]: Initialization of mysqld failed: 0
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service: control process exited, code=exited status=1
3月 14 03:55:06 localhost.localdomain systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
3月 14 03:55:06 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service failed.
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service holdoff time over, scheduling restart.
3月 14 03:55:06 localhost.localdomain systemd[1]: Stopped MySQL Server.
-- Subject: Unit mysqld.service has finished shutting down
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has finished shutting down.
3月 14 03:55:06 localhost.localdomain systemd[1]: start request repeated too quickly for mysqld.service
3月 14 03:55:06 localhost.localdomain systemd[1]: Failed to start MySQL Server.
-- Subject: Unit mysqld.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
--
-- Unit mysqld.service has failed.
--
-- The result is failed.
3月 14 03:55:06 localhost.localdomain systemd[1]: Unit mysqld.service entered failed state.
3月 14 03:55:06 localhost.localdomain systemd[1]: mysqld.service failed.
3. Check the log (recommended) :
[root@localhost ~]# cat /var/log/mysqld.log
...
2020-03-13T18:53:16.099273Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2020-03-13T18:53:16.099347Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2020-03-13T18:53:16.099357Z 0 [ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
2020-03-13T18:53:16.099369Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2020-03-13T18:53:16.718886Z 0 [ERROR] Plugin 'InnoDB' init function returned error.
2020-03-13T18:53:16.718953Z 0 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
2020-03-13T18:53:16.718962Z 0 [ERROR] Failed to initialize builtin plugins.
2020-03-13T18:53:16.718966Z 0 [ERROR] Aborting
Erratum:
After viewing the log, you can see the ERROR information in the log. If you do not understand, you can translate it for the convenience of understanding and searching for useful information.
[ERROR] InnoDB: Operating system error number 13 in a file operation.
[ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
[ERROR] InnoDB: os_file_get_status() failed on './ibdata1'. Can't determine file permissions
[ERROR] InnoDB: Plugin initialization aborted with error Generic error
[ERROR] Plugin 'InnoDB' init function returned error.
[ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
[ERROR] Failed to initialize builtin plugins.
[ERROR] Aborting
↓↓↓↓↓↓
[Bug] InnoDB: Operating system error number 13 in file manipulation.
[Bug] InnoDB: This error means that mysqld does not have access to this directory.
[error] InnoDB: os_file_get_status() failed on. /ibdata1. could not determine file permissions.
[Bug] InnoDB: Plugin initialization aborted, error occurred General error
Bug]The plug-in "InnoDB" initialization function returns an error.
Bug]Failed to register the plug-in "InnoDB" as a storage engine.
Bug]Failed to initialize the built-in plug-in.
Bug]The plug-in "InnoDB" failed to register as a storage engine.
Solutions:
[root@localhost ~]# getenforce //selinux stat
Enforcing
[root@localhost ~]# setenforce 0 //Temporarily shut down selinux, reboot does not work
[root@localhost ~]# getenforce
Permissive
[root@localhost ~]# systemctl start mysqld //Start mysql service successfully
[root@localhost ~]# ss -antulp | grep :3306
tcp LISTEN 0 80 [::]:3306 [::]:* users:(("mysqld",pid=74057,fd=17))
Turn selinux off permanently
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=enforcing
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Backup configuration file
[root@localhost ~]# cp -r /etc/selinux/config /etc/selinux/config.bak
[root@localhost ~]# sed -i 's/SELINUX=enforcing/\SELINUX=disabled/' /etc/selinux/config
[root@localhost ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of three two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
Left left left left left left down down down down down
Recently I just applied for a WeChat public account, above will also share some operation and maintenance knowledge, everyone little fortune hand attention a wave, thank you. [original public account] : not famous operation and maintenance [welfare] : public account reply "materials" send operation and maintenance self-study materials gift package oh!
Read More:
- net start mysql System error 2 has occurred. The system cannot find the file specified.
- Centos 7 | mariadb/mysql | [ERROR] InnoDB: Unable to lock ./ibdata1 error: 11
- Error messages of copying files to Linux system by PSCP in Windows operating system
- Unable to open the physical file “d:\***.mdf”. Operating system error 5: “5(Access is denied.)”.
- Openproj reported error errno = 193 in 64 bit operating system
- SQL Server import MDF and LDF files appear: unable to open physical file “D:\ XX.mdf “。 Operating system error 5: “5 (access denied. )”Solutions
- Solution to “550 create directory operation failed” in FTP operation file
- Windows 10 startup item repair an operating system was’t found solution
- error 1962:no operating system found.boot sequence will automatically repeat.
- Windows 10 startup item repair an operating system wasn’t found
- Error: 17053 LogWriter: Operating system error 21(The device is not ready.)
- Lenovo-win7 system computer boot prompt error 1962: no operating
- Error report of xv6 operating system make Makefile:192 : * * solutions to receive comments before first target. Stop
- A convenient method to count the total number of query results in MySQL
- Error 1045 (28000) access denied for user ‘root’ @’localhost ‘appears in MySQL under Windows system
- [Solved] Imx6qdl Android 5.0 kernel 3.10 can’t mount system file system
- Mac: how to show hidden files under Apple Mac operating system
- Solution to error 2002 (HY000) in MySQL login startup
- [Solved] CAP_IMAGES: can‘t find starting number (in the name of file)
- [MySQL] error 1396 (HY000): Operation create user failed for ‘MySQL’ @’localhost ‘