Obtain MySQL permissions for files and folders in Linux (SELinux)

Source: Internet
Author: User
Obtain MySQL permissions for files and folders in Linux (SELinux)

Obtain MySQL permissions for files and folders in Linux (SELinux)

Homepage → Database Technology

Background:

Read News

Obtain MySQL permissions for files and folders in Linux (SELinux)

[Date: 2012-11-22] Source: Linux Author: chencong112 [Font:]

Move the MySQL database directory on Linux today

The configuration is as follows:

/Etc/my. cnf

[Mysqld]
Datadir =/home/mysql
Socket =/var/lib/mysql. sock

The following problems occur when the configuration file is changed and MYSQL is restarted:

110222 11:15:07 mysqld_safe Starting mysqld daemon with databases from/home/mysql
110222 11:15:07 [Warning] Can't create test file/home/mysql/localhost. lower-test
110222 11:15:07 [Warning] Can't create test file/home/mysql/localhost. lower-test
/Usr/libexec/mysqld: Can't find file: './mysql/plugin. frm' (errno: 13)
110222 11:15:07 [ERROR] Can't open the mysql. plugin table. Please run mysql_upgrade to create it.
110222 11:15:07 InnoDB: Operating system error number 13 in a file operation.
InnoDB: The error means mysqld does not have the access rights
InnoDB: the directory.
InnoDB: File name./ibdata1
InnoDB: File operation call: 'Open '.
InnoDB: Cannot continue operation.
110222 11:15:07 mysqld_safe mysqld from pid file/var/run/mysqld. pid ended

I thought it was just a file or folder permission problem. I changed all the corresponding directory and file permissions to read/write status... it is still useless...

After searching for a while on the internet, I found a solution ~

The solution is as follows:

# Enter the following line in the terminal

Chown-R mysql: mysql/home/data/mysql
# Enter the following line and it will be OK.

Chcon-R-t mysqld_db_t/home/mysql

# Try restarting MYSQL ~

/Etc/init. d/mysqld restart

  • 0
  • PL/SQL cannot connect to the Oracle database

    High-performance data creation using MySQL triggers

    SELinux Linux SELinux

    Image Information

    View All comments in this article (0)

    Comments

    Latest Information

    Popular this week

    Introduction to Linux community-advertisement service-website map-help Info-contact us
    The articles published on this site (LinuxIDC) do not mean that they agree with the statement or description. They only provide more information and do not constitute any suggestions.


    Copyright©2006-2014 Linux community All rights reserved Zhejiang ICP backup No. 06018118

    ,

    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.