Problem:
[Warning] Can ' t create test file Xxx.lower-test
[Warning] Can ' t create test file Xxx.lower-test
Usrlibexecmysqld Can ' t change dir to ' xxx ' (Errcode 13)
Solution:
First. SELinux, install Redhat (very old OS ...) When there is such an option, usually everyone listens to predecessors ' suggestions and changes the default value to not install it. But if you happen to be working on this machine with SELinux, it does make it impossible for your MySQL to mysql_install_db in the new target location and report the warning as shown in the question. A simple workaround is to use the command to temporarily turn off SELinux so that your operation can continue Setenforce 0
It is a good idea to use a permanent method so that you do not have the goods after a reboot.
Modify the/etc/selinux/config file to set the selinux=disabled, and then restart or wait for the next reboot.
Second, AppArmor, the pit Daddy and SELinux pit Dad, it also limits the directory permissions that MySQL can use. In/etc/apparmor.d/usr.sbin.mysqld This file, there are two lines that specify the data file path permissions that MySQL uses
/VAR/LIB/MYSQL/R,
/var/lib/mysql/** Rwk,
You must have seen it,/var/lib/mysql/. The default path for MySQL-installed data files, AppArmor controls the permissions of the directories that MYSQLD can use here
I want to move the data file to/data/mysql, then in order to make mysqld can use/data/mysql this directory, according to the above two, add the following two lines can be
/DATA/MYSQL/R,
/data/mysql/** Rwk,
Restart Apparmor,/etc/inid.d/apparmor restart
Get!
Centos 6.5 After installing MYSQL change storage path problem