[ale] selinux and moving mysql datadir

Jim Kinney jim.kinney at gmail.com
Fri Feb 13 17:38:23 EST 2009


You will need to give the new data space the exact same settings in
selinux as the old space had.

ls -Z shows selinux metadata.

For instance: my /var/lib/mysql looks like:
drwxr-xr-x  mysql mysql system_u:object_r:mysqld_db_t:s0 mysql
It's the 4 objects colon delimited that matter.

chcon is a temporary adjuster. It may be easier to copy the original
data to it's new location using cp --preserve=context

Otherwise you will need to make a permanent change using semanage.
It's a tad clunky but workable. See the Fedora 10 SELinux page here:
http://docs.fedoraproject.org/selinux-user-guide/f10/en-US/sect-Security-Enhanced_Linux-SELinux_Contexts_Labeling_Files-Persistent_Changes_semanage_fcontext.html

In fact, that entire document is an excellent read for anyone getting
in up to their elbows in selinux.

On Fri, Feb 13, 2009 at 5:23 PM, Atlanta Geek <atlantageek at gmail.com> wrote:
> I've stopped mysql and moved an existing mysql database to a bigger partition.
> When I try to start mysql I get the error "Can't change dir to ..."
> Now if I put selinux in permissive mode it works fine.
>
> I've even tried using chcon on the new directory but obviously I have
> no idea what I am doing.
> Any suggestions what I may be doing wrong or you to get around this.
> Maybe some info on chcon.
>
>
> --
> http://www.atlantageek.com
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://mail.ale.org/mailman/listinfo/ale
>



-- 
-- 
James P. Kinney III


More information about the Ale mailing list