Files and folders in Linux get MySQL permissions (SELinux)

Source: Internet
Author: User
Tags file permissions

Move MySQL database directory today on Linux systems

The configuration is as follows:

/etc/my.cnf

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

After you change the configuration file, the following issues occur when you restart MySQL

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 in a file operation.
Innodb:the error means mysqld does not has the access rights to
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/mysqld.pid ended

Originally thought is only the file or folder permission problem, the corresponding directory and file permissions to change to read and write status ... It's still useless ...

Look for a moment on the Internet, find a solution ~

Here's how to fix it:

#在终端中先输入下面这一行

Chown-r Mysql:mysql/home/data/mysql
#在输入下面的一行就OK了

Chcon-r-T Mysqld_db_t/home/mysql

#重启下MYSQL试试 ~

/etc/init.d/mysqld restart

Files and folders in Linux get MySQL permissions (SELinux)

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.