openeuler-24.3欧拉系统mysql开机自启报错
本地部署mysql服务,某天突然停电,导致数据库服务器重启了,然后第二天发现数据服务没有起来,mysql设置开机自启了,还是没有正常启动。登陆上去一看报错信息入下:
[root@db-01 ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: deactivating (stop-sigterm) (Result: exit-code)
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3067450 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Process: 3067469 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
Tasks: 18 (limit: 47381)
Memory: 168.2M
CGroup: /system.slice/mysqld.service
└─ 3067471 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927501Z 0 [Note] Shutting down plugin ‘INNODB_CMP’
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927504Z 0 [Note] Shutting down plugin ‘INNODB_LOCK_WAITS’
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927507Z 0 [Note] Shutting down plugin ‘INNODB_LOCKS’
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927510Z 0 [Note] Shutting down plugin ‘INNODB_TRX’
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927512Z 0 [Note] Shutting down plugin ‘InnoDB’
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927627Z 0 [Note] InnoDB: FTS optimize thread exiting.
9月 28 11:48:20 db-01 mysqld[3067471]: 2025-09-28T03:48:20.927763Z 0 [Note] InnoDB: Starting shutdown…
9月 28 11:48:20 db-01 systemd[1]: mysqld.service: Control process exited, code=exited, status=1/FAILURE
9月 28 11:48:21 db-01 mysqld[3067471]: 2025-09-28T03:48:21.027960Z 0 [Note] InnoDB: Dumping buffer pool(s) to /var/lib/mysql/ib_buffer_pool
9月 28 11:48:21 db-01 mysqld[3067471]: 2025-09-28T03:48:21.028225Z 0 [Note] InnoDB: Buffer pool(s) dump completed at 250928 11:48:21
× mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Sun 2025-09-28 11:50:22 CST; 773ms ago
Docs: man:mysqld(8)
http://dev.mysql.com/doc/refman/en/using-systemd.html
Process: 3081500 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)
Process: 3081519 ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS (code=exited, status=1/FAILURE)
9月 28 11:50:22 db-01 systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 3.
9月 28 11:50:22 db-01 systemd[1]: Stopped MySQL Server.
9月 28 11:50:22 db-01 systemd[1]: mysqld.service: Start request repeated too quickly.
9月 28 11:50:22 db-01 systemd[1]: mysqld.service: Failed with result ‘exit-code’.
9月 28 11:50:22 db-01 systemd[1]: Failed to start MySQL Server.
[ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:28:00 db-01 mysqld[3998858]: 2025-09-28T06:28:00.074313Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:28:00 db-01 mysqld[3998858]: 2025-09-28T06:28:00.074318Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:28:00 db-01 mysqld[3998858]: 2025-09-28T06:28:00.074355Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.809660Z 0 [Note] InnoDB: If the mysqld execution user is authorized, page cleaner thread priority can be changed. See the man page of setpriority().
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822031Z 0 [Note] InnoDB: Highest supported file format is Barracuda.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822147Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822153Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822158Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822168Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822172Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822176Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822185Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822188Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822192Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822200Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822203Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822207Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822217Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822220Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822224Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822236Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822240Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822243Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822252Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822255Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822258Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822267Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822271Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822274Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822283Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822286Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822289Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822300Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822304Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822307Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822318Z 0 [ERROR] InnoDB: Operating system error number 13 in a file operation.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822322Z 0 [ERROR] InnoDB: The error means mysqld does not have the access rights to the directory.
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822325Z 0 [ERROR] InnoDB: os_file_readdir_next_file() returned -1 in directory ./, crash recovery may have failed for some .ibd files!
9月 28 14:38:29 db-01 mysqld[4059521]: 2025-09-28T06:38:29.822336Z 0 [ERROR] InnoDB: Plugin initialization aborted with error Generic error
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423007Z 0 [ERROR] Plugin ‘InnoDB’ init function returned error.
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423057Z 0 [ERROR] Plugin ‘InnoDB’ registration as a STORAGE ENGINE failed.
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423068Z 0 [ERROR] Failed to initialize builtin plugins.
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423074Z 0 [ERROR] Aborting
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423135Z 0 [Note] Binlog end
9月 28 14:38:30 db-01 mysqld[4059519]: Initialization of mysqld failed: 0
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423233Z 0 [Note] Shutting down plugin ‘CSV’
9月 28 14:38:30 db-01 mysqld[4059521]: 2025-09-28T06:38:30.423574Z 0 [Note] /usr/sbin/mysqld: Shutdown complete
9月 28 14:38:30 db-01 systemd[1]: mysqld.service: Control process exited, code=exited, status=1/FAILURE
9月 28 14:38:30 db-01 systemd[1]: mysqld.service: Failed with result ‘exit-code’.
9月 28 14:38:30 db-01 systemd[1]: Failed to start MySQL Server.
9月 28 14:38:30 db-01 systemd[1]: mysqld.service: Scheduled restart job, restart counter is at 5.
9月 28 14:38:30 db-01 systemd[1]: Stopped MySQL Server.
9月 28 14:38:30 db-01 systemd[1]: mysqld.service: Start request repeated too quickly.
9月 28 14:38:30 db-01 systemd[1]: mysqld.service: Failed with result ‘exit-code’.
9月 28 14:38:30 db-01 systemd[1]: Failed to start MySQL Server.
经过排查没有问题,也不是目录损坏,都正常之后,mysql服务还是不能启动。然后突然想到防火墙查看防火墙也是正常的。然后想到欧拉系统的selinux服务需要手动设置成disabled。才能正常启动,于是把seliunx设置成disabled,之前部署时临时设置成0了,所以导致服务器重启后,mysql服务设置开机自启也没有启动起来。临时关闭一下seliunx服务(setenforce 0)再重启一下mysql服务就正常了。
#设置seliunx
setenforce 0 && sed -i 's/SELINUX=enforcing/SELINUX=disabled/g' /etc/selinux/config
