How can I solve the problem caused by modifying datadir in Mysql?

Source: Internet
Author: User
Centos6.2, stop mysqld, modify the location of etcmy. cnfdatadir, start mysqld and prompt FAILED. The log code is as follows: 12060911: 31: FAILED: 35: 12mysqld_safeStartingmysqlddaemonwithdata.

Centos6.2, stop mysqld, and modify/etc/my. cnf datadir location, start mysqld and prompt FAILED. view the Log Code 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 data

Centos6.2, stop mysqld, modify the location of/etc/my. cnf datadir, start mysqld and prompt FAILED to view logs

The 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.

The 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.

The 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

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.