oracle linux下yum安装mysql8初始化后无法启动问题 mysqld File auto.cnf not found
yum安装没有问题 执行初始化命令执行也没有问题 mysqld –user=mysql –datadir=/var/lib/data –lower-case-table-names=1 –initialize- insecure 执行启动命令无法启动 查看mysql的日志如下 2023-09-21T08:47:39.248185Z 0 [System] [MY- 013169] [Server] /usr/sbin/mysqld (mysqld 8.0.34) initializing of server in progress as p rocess 14205 2023-09-21T08:47:39.257367Z 1 [System] [MY- 013576] [InnoDB] InnoDB initialization has started. 2023-09-21T08:47:39.815707Z 1 [System] [MY- 013577] [InnoDB] InnoDB initialization has ended. 2023-09-21T08:47:41.364490Z 6 [Warning] [MY- 010453] [Server] root@localhost is created with an empty password ! Please consider switc hing off the –initialize-insecure option. 2023-09-21T08:48:23.110943Z 0 [System] [MY- 010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 14314 2023-09-21T08:48:23.116456Z 0 [Warning] [MY- 010075] [Server] No existing UUID has been found, so we assume that this is the first tim e that this server has been started. Generating a new UUID: 9f31a861-585b-11ee-a8e0- 00505685cbf9. mysqld: File ‘/var/lib/data/auto.cnf’ not found (OS errno 13 - Permission denied) 2023-09-21T08:48:23.116508Z 0 [ERROR] [MY- 010183] [Server] Failed to create file(file: ‘/var/lib/data/auto.cnf’, errno 13) 2023-09-21T08:48:23.116516Z 0 [ERROR] [MY- 010076] [Server] Initialization of the server’s UUID failed because it could not be read from the auto.cnf file. If this is a new server, the initialization failed because it was not possible to generate a new UUID. 2023-09-21T08:48:23.116543Z 0 [ERROR] [MY-010119] [Server] Aborting 2023-09-21T08:48:23.116995Z 0 [System] [MY- 010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.34) MySQL Community Ser ver - GPL. 一直报 mysqld: File ‘/var/lib/data/auto.cnf’ not found (OS errno 13 - Permissio n denied)
无论怎么赋权都不行 chmod -R 777 /var/lib/data chmod -R 777 /var/lib/data/auto.cnf chmod -R 755 /var/lib/data 最后将auto.cnf移除,报如下错误 2023-09-21T08:53:50.377462Z 0 [System] [MY- 010116] [Server] /usr/sbin/mysqld (mysqld 8.0.34) starting as process 14810 2023-09-21T08:53:50.381645Z 0 [Warning] [MY- 010075] [Server] No existing UUID has been found, so we assume that this is the first tim e that this server has been started. Generating a new UUID: 62425c40-585c-11ee-80b9- 00505685cbf9. 2023-09-21T08:53:50.388255Z 1 [System] [MY- 013576] [InnoDB] InnoDB initialization has started. 2023-09-21T08:53:50.388445Z 1 [ERROR] [MY- 012592] [InnoDB] Operating system error number 13 in a file operation. 2023-09-21T08:53:50.388478Z 1 [ERROR] [MY- 012595] [InnoDB] The error means mysqld does not have the access rights to the directory. 2023-09-21T08:53:50.388496Z 1 [ERROR] [MY- 012270] [InnoDB] os_file_get_status() failed on ‘./ibdata1’. Can’t determine file permiss ions 2023-09-21T08:53:50.388537Z 1 [ERROR] [MY- 010334] [Server] Failed to initialize DD Storage Engine 2023-09-21T08:53:50.388800Z 0 [ERROR] [MY- 010020] [Server] Data Dictionary initialization failed. 2023-09-21T08:53:50.388871Z 0 [ERROR] [MY-010119] [Server] Aborting 2023-09-21T08:53:50.389722Z 0 [System] [MY- 010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.34) MySQL Community Ser ver - GPL. [错误] InnoDB:文件操作中的操作系统错误号13。 [错误] InnoDB:该错误意味着mysqld没有访问该目录的权限。 [错误] InnoDB: os_file_get_status()在上失败。/ibdata1。无法确定文件权限 [错误] InnoDB:插件初始化中止,出现错误一般错误 [错误]插件“InnoDB”初始化函数返回错误。 [错误]插件“InnoDB”注册为存储引擎失败。 [错误]初始化内置插件失败。
[错误]中止 出现新的报错Operating system error number 13 in a file operation. 查询报错得到如下的博客 解决方法如下 [root@localhost ~]# getenforce //查看selinux状态 Enforcing [root@localhost ~]# setenforce 0 //临时关闭selinux,重启后失效 [root@localhost ~]# getenforce Permissive [root@localhost ~]# systemctl start mysqld //启动mysql服务成功 [root@localhost ~]# ss -antulp | grep :3306 tcp LISTEN 0 80 [::]:3306 [::]:* users: ((“mysqld”,pid=74057,fd=17)) 备份配置文件 [root@localhost ~]# cp -r /etc/selinux/config /etc/selinux/config.bak 永久关闭selinux [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