Ask Your Question

selinux issues with MySQL installed from dev. repo.

asked 2016-01-04 04:12:40 -0500

VinceK gravatar image

updated 2016-01-04 06:05:41 -0500

I have mysql installed from the MySQL dev. repo..

The task is to import CSV files.

The problem is the default mysql config. only allows import from the /var/lib/mysql-files directory (config. option --secure-file-priv), which results in a selinux error when mysql attempts to access the files in this dir.:

SELinux is preventing mysqld from getattr access on the file /var/lib/mysql-files/sr28_ABBREV.csv.

There is a fix suggested:

# grep mysqld /var/log/audit/audit.log | audit2allow -M mypol
# semodule -i mypol.pp

The problem is I need to fix this for all /var/lib/mysql-files/sr28_*.csv CSV files in /var/lib/mysql-files, not just the one.

Is there a selinux config. line that will do this?

edit retag flag offensive close merge delete


Hi: Look at this link, this' a common problem with MySQL.

Kind regards

casep gravatar imagecasep ( 2016-01-04 06:03:53 -0500 )edit

Thanks for that.

VinceK gravatar imageVinceK ( 2016-01-05 01:08:39 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2016-01-04 07:46:45 -0500


Did you copy the files into /var/lib/mysql-files manually? Check their context with ls -lZ /var/lib/mysql-files? It should look something like this: system_u:object_r:mysqld_db_t:s0. If the context is different from mysqld_db_t, run following command to narrow the context down and try again:

restorecon -Rv /var/lib/mysql-files

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2016-01-04 04:12:40 -0500

Seen: 132 times

Last updated: Jan 04 '16