Erro Aparmor após a relocação da pasta mysql

2

Eu mudei a pasta mysql. Eu usei este link .

Eu não consigo iniciar o serviço mysql e tenho esta mensagem de erro

Unit mysql.service has begun starting up.
Aug 26 02:53:19 ubuntu audit[1345]: AVC **apparmor="DENIED**" operation="open" profi                                                 le="/usr/sbin/mysqld" name="/proc/1345/status" pid=1345 comm="mysqld" requested_                                                 mask="r" denied_mask="r" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.505:43): apparm                                                 or="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/1345/status"                                                  pid=1345 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu audit[1345]: AVC apparmor="DENIED" operation="open" profi                                                 le="/usr/sbin/mysqld" name="/sys/devices/system/node/" pid=1345 comm="mysqld" re                                                 quested_mask="r" denied_mask="r" fsuid=109 ouid=0
Aug 26 02:53:19 ubuntu audit[1345]: AVC apparmor="DENIED" operation="open" profi                                                 le="/usr/sbin/mysqld" name="/proc/1345/status" pid=1345 comm="mysqld" requested_                                                 mask="r" denied_mask="r" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.513:44): apparm                                                 or="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/sys/devices/syste                                                 m/node/" pid=1345 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=109 oui                                                 d=0
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.513:45): apparm                                                 or="DENIED" operation="open" profile="/usr/sbin/mysqld" name="/proc/1345/status"                                                  pid=1345 comm="mysqld" requested_mask="r" denied_mask="r" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu audit[1345]: AVC apparmor="DENIED" operation="mknod" prof                                                 ile="/usr/sbin/mysqld" name="/ssd/ubuntu.lower-test" pid=1345 comm="mysqld" requ                                                 ested_mask="c" denied_mask="c" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu audit[1345]: AVC apparmor="DENIED" operation="mknod" prof                                                 ile="/usr/sbin/mysqld" name="/ssd/ubuntu.lower-test" pid=1345 comm="mysqld" requ                                                 ested_mask="c" denied_mask="c" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.661:46): apparm                                                 or="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/ssd/ubuntu.lower                                                 -test" pid=1345 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=109 ouid=                                                 109
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.661:47): apparm                                                 or="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/ssd/ubuntu.lower                                                 -test" pid=1345 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=109 ouid=                                                 109
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.665:48): apparm                                                 or="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/ssd/ubuntu.lower                                                 -test" pid=1345 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=109 ouid=                                                 109
Aug 26 02:53:19 ubuntu audit[1345]: AVC apparmor="DENIED" operation="mknod" prof                                                 ile="/usr/sbin/mysqld" name="/ssd/ubuntu.lower-test" pid=1345 comm="mysqld" requ                                                 ested_mask="c" denied_mask="c" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu audit[1345]: AVC apparmor="DENIED" operation="mknod" prof                                                 ile="/usr/sbin/mysqld" name="/ssd/ibdata1" pid=1345 comm="mysqld" requested_mask                                                 ="c" denied_mask="c" fsuid=109 ouid=109
Aug 26 02:53:19 ubuntu kernel: audit: type=1400 audit(1503741199.685:49): apparm                                                 or="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/ssd/ibdata1" pid                                                 =1345 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=109 ouid=109
Aug 26 02:53:20 ubuntu systemd[1]: mysql.service: Main process exited, code=exit                                                 ed, status=1/FAILURE

Como posso resolver isso?

    
por István Radics 26.08.2017 / 12:24

2 respostas

1

Eu segui os seguintes passos para mudar o diretório de dados padrão no mysql:

Eu tenho a configuração do sistema como segue

% bl0ck_qu0te%

Os passos são os seguintes:

  1. Pare o servidor mysql service mysql stop
  2. Edite o arquivo /etc/mysql/mysql.conf.d/mysqld.cnf e edite o campo datadir para apontar para o novo local.

    Por exemplo, datadir = /data/mysql

  3. Copie o conteúdo de /var/lib/mysql para o novo local:

    cp -pr /var/lib/mysql /data
    
  4. Em seguida, edite o arquivo /etc/apparmor.d/usr.sbin.mysqld . Remova /var/lib/mysql e adicione o novo local datadir . No meu caso é

     # Allow data dir access
     /data/mysql/ r,
     /data/mysql/** rwk,
    
  5. Reinicie o serviço apparmor systemctl restart apparmor

  6. Reinicie o serviço mysql service mysql start

    Os passos acima funcionaram para mim, espero que funcione para você também.

por Bidyut 28.08.2017 / 11:36
1

Sempre verifique o status do Apparmor

  1. sudo service apparmor status
  2. Se não estiver ativo, use journalctl -xe e verifique qual perfil tem problemas.
por Manuel 16.10.2018 / 20:01