Centos 6.5 After installing MYSQL change storage path problem

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.