Known as one of the most popular open source database, MySQL is widely used in various scenarios, ApsaraDB RDS for MySQL of Alibaba Cloud provided critical relief for companies, especially small and medium-sized enterprises affected by novel coronavirus (COVID-19).
Add by Zhj: Modify the DataDir of the database, then the database will not start, the error is as follows
2014-12-11 16:22:57 26309[Warning]Can '
2014-12-11 16:22:57 26309 [Warning] Can‘t create test file /data/mysql/server2.lower-test
2014-12-11 16:22:57 26309 [Warning] Can‘t create test file /data/mysql/server2.lower-test
2014-12-11 16:22:57 26309 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2014-12-11 16:22:57 26309 [Warning] Buffered warning: Changed limits: table_cache: 431 (requested 2000)
2014-12-11 16:22:57 26309 [Note] Plugin ‘FEDERATED‘ is disabled.
^G/usr/sbin/mysqld: Can‘t find file: ‘./mysql/plugin.frm‘ (errno: 13 - Permission denied)
2014-12-11 16:22:57 26309 [ERROR] Can‘t open the mysql.plugin table. Please run mysql_upgrade to create it.
This article was found in the back and solved the problem. It is also stated that AppArmor not only restricts the DataDir directory of MySQL, but also restricts the directory of Config,log and so on.
SELinux is also very well written in the MySQL article.
Original: http://www.huoxingfan.com/834.html
I think you must be searching for this title from search engine! You must be trying to change the MySQL default installed data directory !
You have modified the value of DataDir in MY.CNF.
You've chown and chmod several times. New Data directory or owner and permission of its parent path
You tried countless times to service MySQL start, or/etc/init.d/mysql start, and mysql_install_db!
Congratulations on seeing this article, I found a solution after being trapped by the system for a few hours.
There are two of these reasons, and any one of them can cause you to be notified of this warning by the system. If you are not a professional Linux system security engineer, or you are just a PHP program
No thorough study of system security, you will not find the answer to it too easily.
First, SELinux, remember that year when studying, character interface installation Redhat (very old operating system ...) ), there is an option, usually we listen to the advice of the Elder, change
Change 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 do mysql_install_db in the new target location, and
Burst the warning shown in the title. A simple workaround is to use the command to temporarily turn off SELinux so that your operation can continue
Setenforce 0
However, it is best 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, 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
After that, you'll be able to do what you want to do.
MySQL [Warning] Can ' t ' Create test file xxx lower-test (GO)