1、启动MySQL失败
[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.
2、通过查看MySQL错误日志分析,日志文件路径可通过/etc/my.cnf查看
[root@localhost ~]# tail -fn 200 /var/log/mysqld.log
2022-12-29T11:47:48.258403Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2022-12-29T11:47:48.260168Z 0 [Note] /usr/sbin/mysqld (mysqld 5.7.40) starting as process 17893 ...
2022-12-29T11:47:48.263792Z 0 [Note] InnoDB: PUNCH HOLE support available
2022-12-29T11:47:48.263822Z 0 [Note] InnoDB: Mutexes and rw_locks use GCC atomic builtins
2022-12-29T11:47:48.263826Z 0 [Note] InnoDB: Uses event mutexes
2022-12-29T11:47:48.263829Z 0 [Note] InnoDB: GCC builtin __atomic_thread_fence() is used for memory barrier
2022-12-29T11:47:48.263836Z 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2022-12-29T11:47:48.263839Z 0 [Note] InnoDB: Using Linux native AIO
2022-12-29T11:47:48.264145Z 0 [Note] InnoDB: Number of pools: 1
2022-12-29T11:47:48.264276Z 0 [Note] InnoDB: Using CPU crc32 instructions
2022-12-29T11:47:48.266137Z 0 [Note] InnoDB: Initializing buffer pool, total size = 128M, instances = 1, chunk size = 128M
2022-12-29T11:47:48.273450Z 0 [Note] InnoDB: Completed initialization of buffer pool
2022-12-29T11:47:48.275630Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
2022-12-29T11:47:48.285893Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
2022-12-29T11:47:48.285913Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
2022-12-29T11:47:48.285919Z 0 [ERROR] InnoDB: os_file_get_status() failed on \'./ibdata1\'. Can\'t determine file permissions
2022-12-29T11:47:48.285927Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
2022-12-29T11:47:48.886868Z 0 [ERROR] Plugin \'InnoDB\' init function returned error.
2022-12-29T11:47:48.886924Z 0 [ERROR] Plugin \'InnoDB\' registration as a STORAGE ENGINE failed.
2022-12-29T11:47:48.922718Z 0 [ERROR] Failed to initialize builtin plugins.
2022-12-29T11:47:48.922781Z 0 [ERROR] Aborting
2022-12-29T11:47:48.922889Z 0 [Note] Binlog end
2022-12-29T11:47:48.923155Z 0 [Note] Shutting down plugin \'CSV\'
2022-12-29T11:47:48.923820Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
翻译内容大致意思:
[错误] InnoDB:文件操作中的操作系统错误号13。
[错误] InnoDB:该错误意味着mysqld没有访问该目录的权限。
[错误] InnoDB: os_file_get_status()在上失败。/ibdata1。无法确定文件权限
[错误] InnoDB:插件初始化中止,出现错误一般错误
[错误]插件\"InnoDB\"初始化函数返回错误。
[错误]插件\"InnoDB\"注册为存储引擎失败。
[错误]初始化内置插件失败。
[错误]中止
3、解决方法
1)查看selinux状态
[root@localhost ~]# getenforce
<span style=\"box-sizing: inherit; -webkit-tap-highlight-color: transparent; border: 0px; font-family: 华文中宋; font-size: 12pt; font-style: inherit; margin: 0px; padding: 0px; vertical-align: baseline; color: rgb(