mariadb: make it be able to work with SELinux
PATCH 1/1 mariadb: make it be able to work with SELinux
From: Roy Li <[email protected]>
1. change the datadir from /var/mysql to /var/lib/mysql
2. after creating datedir, restorecon on it, make SELinux be able to work
3. Add the PIDFile for systemd unit file, otherwise systemctl can not stop mysqld
--- meta-oe/recipes-support/mysql/mariadb.inc | 1 + meta-oe/recipes-support/mysql/mariadb/my.cnf | 2 +- meta-oe/recipes-support/mysql/mariadb/mysqld.service | 1 + 3 files changed, 3 insertions(+), 1 deletion(-)
meta-oe/recipes-support/mysql/mariadb.inc +1 -0
@@ -128,6 +128,7 @@ pkg_postinst_${PN}-server () { mysql_install_db --basedir=${prefix} --user=mysql + [ -x /sbin/restorecon ] && /sbin/restorecon -RF /var/lib/mysql } PACKAGES = "${PN}-dbg ${PN} \
meta-oe/recipes-support/mysql/mariadb/my.cnf +1 -1
@@ -13,7 +13,7 @@ socket = /var/lib/mysql/mysql.sock pid-file = /var/lib/mysql/mysqld.pid log-error = /var/log/mysqld.err basedir = /usr -datadir = /var/mysql +datadir = /var/lib/mysql skip-external-locking skip-networking ignore-builtin-innodb
meta-oe/recipes-support/mysql/mariadb/mysqld.service +1 -0
@@ -4,6 +4,7 @@ After=syslog.target After=network.target [Service] +PIDFile=/var/lib/mysql/mysqld.pid Type=simple User=mysql Group=mysql
Signature · 1 line
2.1.0
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
[email protected] schreef op 06-02-15 om 06:59:
Quoted 5 lines
From: Roy Li <[email protected]>
1. change the datadir from
/var/mysqlto/var/lib/mysql2. after creating datedir, restorecon on it, make SELinux be able to work 3. Add the PIDFile for systemd unit file, otherwise systemctl can not stop mysqld
Shouldn't those all use the ${localstatedir} variable instead of hardcoding?
Quoted 33 lines
Signed-off-by Roy Li <[email protected]> ---meta-oe/recipes-support/mysql/mariadb.inc | 1 + meta-oe/recipes-support/mysql/mariadb/my.cnf | 2 +- meta-oe/recipes-support/mysql/mariadb/mysqld.service | 1 + 3 fileschanged, 3 insertions(+), 1 deletion(-)
(quoted diff) +0
-0b/meta-oe/recipes-support/mysql/mariadb.inc index 8068862..f385bfc 100644 --- a/meta-oe/recipes-support/mysql/mariadb.inc +++ b/meta-oe/recipes-support/mysql/mariadb.inc @@ -128,6 +128,7 @@ pkg_postinst_${PN}-server () {
mysql_install_db--basedir=${prefix} --user=mysql+ [ -x
/sbin/restorecon] &&/sbin/restorecon-RF/var/lib/mysql}PACKAGES = "${PN}-dbg ${PN} \ diff --git a/meta-oe/recipes-support/mysql/mariadb/my.cnf b/meta-oe/recipes-support/mysql/mariadb/my.cnf index 876ce36..28d3899 100644 --- a/meta-oe/recipes-support/mysql/mariadb/my.cnf +++ b/meta-oe/recipes-support/mysql/mariadb/my.cnf @@ -13,7 +13,7 @@ socket
=/var/lib/mysql/mysql.sockpid-file =/var/lib/mysql/mysqld.pid
log-error =/var/log/mysqld.errbasedir = /usr -datadir =/var/mysql+datadir =/var/lib/mysqlskip-external-locking
skip-networking ignore-builtin-innodb diff --git a/meta-oe/recipes-support/mysql/mariadb/mysqld.service b/meta-oe/recipes-support/mysql/mariadb/mysqld.service index 18ad8d5..757d038 100644 --- a/meta-oe/recipes-support/mysql/mariadb/mysqld.service +++ b/meta-oe/recipes-support/mysql/mariadb/mysqld.service @@ -4,6 +4,7 @@ After=syslog.target After=network.target
Quoted 3 lines
[Service] +PIDFile=/var/lib/mysql/mysqld.pid Type=simple User=mysql Group=mysql
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.5 (Darwin)
Comment: GPGTools - http://gpgtools.org
iD8DBQFU1H5NMkyGM64RGpERAiEDAJ9sJEaiGqhauXo0DJD2+cgMPshg8wCgsfHO DBiU69t3NR66pAvdQyNlh/Y=
=KiCJ
-----END PGP SIGNATURE-----