Re: Unable to apply mysqld_db_t to mysql directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On 23 October 2017 at 13:33, Bernard Fay <bernard.fay@xxxxxxxxx> wrote:
> Hello,
>
> A server was configured in /var/lib/myslq in the root fs.  I added a LV
> specifically for mysql.  I stopped myql and renamed /var/lib/mysql to
> /var/lib/mysql.old.  I created a new dir /var/lib/mysql and mounted the LV
> on /var/lib/mysql.  I then copied with "cp -prZ" all mysql files in
> /var/lib/mysql.old to /var/lib/mysql.
>
> But then I got a selinux problem:
> # ls -ldZ mysql.old/ mysql
> drwxr-xr-x. mysql mysql system_u:object_r:var_lib_t:s0   mysql
> drwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql.old/
>
> I tried to changed the context on mysql with the following commands:
>
> # semanage fcontext -a -t mysqld_db_t "/var/lib/mysql(/.*)?"
> # restorecon -R -v /var/lib/mysql
>
> But the /var/lib/mysql directory didn't take the change as you can see
> below:
> # ls -ldZ mysql.old/ mysql
> drwxr-xr-x. mysql mysql system_u:object_r:var_lib_t:s0   mysql
> drwxr-xr-x. mysql mysql system_u:object_r:mysqld_db_t:s0 mysql.old/
>
>
> How can I fix the wrong context on mysql directory?
> Thanks,
>

/var/lib/mysql is already in default policy - no need to add anything there

can you please provide the output of 'semanage fcontext -lC' so that
we can see any local selinux modifications made?

>From base policy with nothing added, for that directory, you *should*
be able to just restorecon -Rv /var/lib/mysql and have the correct
labelling.
_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
https://lists.centos.org/mailman/listinfo/centos



[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]


  Powered by Linux