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)