How to solve the problem caused by modifying datadir in Mysql? mysqldatadir
Centos6.2, stop mysqld, modify the location of/etc/my. cnf datadir, start mysqld and prompt FAILED to view logs
Copy codeThe Code is as follows:
120609 11:31:31 mysqld_safe mysqld from pid file/var/run/mysqld. pid ended
120609 11:35:12 mysqld_safe Starting mysqld daemon with databases from/mnt/hgfs/mysql_data
120609 11:35:13 [Warning] Can't create test file/mnt/hgfs/mysql_data/data. lower-test
120609 11:35:13 [Warning] Can't create test file/mnt/hgfs/mysql_data/data. lower-test
/Usr/libexec/mysqld: Can't change dir to '/mnt/hgfs/mysql_data/' (Errcode: 13)
120609 11:35:13 [ERROR] Aborting
120609 11:35:13 [Note]/usr/libexec/mysqld: Shutdown complete
120609 11:35:13 mysqld_safe mysqld from pid file/var/run/mysqld. pid ended
The new datadir path is correct, and the Directory and all files under the Directory have 777 permissions, and the upper directory also has the rx permission, the only difference is that datadir and its subordinate file owner are both root (because I am using a windows file system mounted by a virtual machine ). Later I thought it would be selinux's ghost. After setting it to permissive mode, I started mysqld normally.
Copy codeThe Code is as follows:
[Root @ data selinux] # getenforce
Enforcing
[Root @ data selinux] # setenforce 0
[Root @ data selinux] # getenforce
Permissive
Setenforce 1 sets SELinux to enforcing Mode
Setenforce 0 sets SELinux to permissive Mode
Disable selinux. Modify SELINUX = disabled in vi/etc/selinux/config.
Copy codeThe Code is as follows:
# 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 these two values:
# Targeted-Targeted processes are protected,
# Mls-Multi Level Security protection.
SELINUXTYPE = targeted