Preface When mysql modified the default database path, the service could not be started. After checking the log, it was found that there was an error in the file permission. For the changed directory, mysql has been set as the owner of the directory! And everything is normal if you start the database directly from the command line. I used the almighty Google and finally found the reason in a post from a foreigner - SELINUX policy issue! All background services need to have corresponding permissions for the corresponding directories, and the default path of mysql /var/lib/mysql has added corresponding policies. After the path is modified, due to the lack of corresponding policies, the background process is blocked from reading files by selinux, resulting in permission errors! Here’s how: mysql, the method is: chcon -R -t mysqld_db_t /db/mysql If it is APACHE, the method is: # chcon -R -h -t httpd_sys_content_t /www/web/ Attached chcon command help
Command format:
illustrate: CONTEXT is the security context to be set FILES Object (Files) --reference reference object PEF_FILES Refer to file context The FILES application refers to the files context as my context. OPTIONS are as follows: -f Force execution -R Recursively modify the security context of an object -r ROLE Modify the configuration of the security context role -t TYPE Modify the configuration of the security context type -u USER Modify the configuration of the security context user -v displays verbose information -l, --range=RANGE Change the security level in the security context mysql, the method is: chcon -R -t mysqld_db_t /db/mysql Examples If you want to share this ftp to anonymous users, you need to enable the following: chcon -R -t public_content_t /var/ftp If you want to allow uploading files to the FTP directory you set, SELINUX needs to be set: chcon -t public_content_rw_t /var/ftp/incoming Allow users to access their home directory via HTTP. This setting is limited to the user's home directory home page: setsebool -P httpd_enable_homedirs 1 chcon -R -t httpd_sys_content_t ~user/public_html If you want to share the samba directory with other users, you need to set: chcon -t samba_share_t /directory When sharing the rsync directory: chcon -t public_content_t /directories Summarize The above is the full content of this article. I hope that the content of this article will have certain reference learning value for your study or work. If you have any questions, you can leave a message to communicate. Thank you for your support for 123WORDPRESS.COM. You may also be interested in:
|
<<: The best way to automatically mount shared directories on Ubuntu 16.04 startup under Virtualbox
>>: vue+springboot realizes login verification code
Step 1: Get the MySQL YUM source Go to the MySQL ...
There is a simple CSS method to realize the pop-u...
1. Image formats supported on the WEB: GIF: can s...
Idea imports an existing web project and publishe...
systemd: The service systemctl script of CentOS 7...
When we type a letter on the keyboard, how is it ...
Table of contents 1. Union Type 2. Crossover Type...
jQuery form validation example / including userna...
HTML: Title Heading is defined by tags such as &l...
The MySQL slow query log is very useful for track...
1. Rendering 2. Source code HTML < body > &...
Event Description onactivate: Fired when the objec...
Table of contents 1. Component Introduction 2. Co...
Table of contents Experimental environment Instal...