# Last Modified: Mon Dec  1 22:23:12 2014

# ------------------------------------------------------------------
#
#    Copyright (C) 2002-2005 Novell/SUSE
#    Copyright (C) 2014-2019 Christian Boltz
#
#    This program is free software; you can redistribute it and/or
#    modify it under the terms of version 2 of the GNU General Public
#    License published by the Free Software Foundation.
#
# ------------------------------------------------------------------
# vim:syntax=apparmor

abi <abi/3.0>,

include <tunables/global>

/usr/sbin/mysqld {
  include <abstractions/base>
  include <abstractions/mysql>
  include <abstractions/nameservice>
  include <abstractions/user-tmp>
  include <abstractions/hosts_access>

  capability dac_override,
  capability setgid,
  capability setuid,

  /etc/my.cnf r,
  /etc/my.cnf.d/ r,
  /etc/my.cnf.d/*.cnf r,
  /root/.my.cnf r,
  /sys/devices/system/cpu/online r,
  /usr/lib{,32,64}/**.so mr,
  /usr/sbin/mysqld mr,
  /usr/share/mariadb/*/errmsg.sys r,
  /usr/share/mysql-community-server/*/errmsg.sys r,
  /usr/share/mysql/** r,
  /var/lib/mysql/ r,
  /var/lib/mysql/** rwlk,
  /var/log/mysql/mysqld-upgrade-run.log w,
  /var/log/mysql/mysqld.log w,
  /var/log/mysql/mysqld.log-20* w,
  /{,var/}run/mysql{,d}/mysqld.pid w,

}
