Problem Description:
After installing mysql in centos7, when doing data migration, point the data directory to a new address, and then systemctl restart mysqld
fail when starting mysql with
Check the log /var/log/mysqld.log and find that the error message is as follows
2023-05-03T08:28:50.048884Z 0 [Warning] [MY-010091] [Server] Can't create test file /mnt/sdb/mysqldata/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2023-05-03T08:28:50.049000Z 0 [System] [MY-010116] [Server] /usr/sbin/mysqld (mysqld 8.0.31) starting as process 18157
2023-05-03T08:28:50.052848Z 0 [Warning] [MY-010091] [Server] Can't create test file /mnt/sdb/mysqldata/mysql/mysqld_tmp_file_case_insensitive_test.lower-test
2023-05-03T08:28:50.052860Z 0 [Warning] [MY-010159] [Server] Setting lower_case_table_names=2 because file system for /mnt/sdb/mysqldata/mysql/ is case insensitive
mysqld: File './binlog.index' not found (OS errno 13 - Permission denied)
2023-05-03T08:28:50.054952Z 0 [ERROR] [MY-010119] [Server] Aborting
2023-05-03T08:28:50.055419Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.0.31) MySQL Community Server - GPL.
problem solved:
#临时关闭selinux防火墙
1.[root@localhost mysql] setenforce 0
#永久关闭:vim /etc/sysconfig/selinux,将selinux=cnforcing改为selinux=disable
2.[root@localhost mysql] vim /etc/sysconfig/selinux
About SELinux
What is SELinux
SELinux (Security-Enhanced Linux) is the implementation of mandatory access control by the National Security Agency (NSA), and is the most outstanding new security subsystem in the history of Linux.
selinux (security enhanced linux) security-enhanced linux, which is a linux kernel module and a security subsystem of linux.
The effect of setenforce 0
Indicates setting SELinux to become permissive mode to temporarily close the selinux firewall and
permanently close it: enter the command vi /etc/selinux/config, change SELINUX=enforcing to SELINUX=disabled, then save and exit
Working mode of SELinux
model | explain |
---|---|
enforcing | Enforcing mode, violations of SELinux rules will be blocked and logged |
permissive | Permissive mode, behaviors that violate SELinux rules will only be recorded in the log for debugging |
disabled | close SELinux |