Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
10
rated 0 times [  10] [ 0]  / answers: 1 / hits: 14862  / 2 Years ago, tue, august 30, 2022, 5:50:04

I relocated the mysql folder. I used this link.



I can not start the mysql service and I have this error message



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


How can I solve it?


More From » mysql

 Answers
7

I followed the following steps to change the default data directory in mysql:



I have the configuration of the system as follows




mysql Ver 14.14 Distrib 5.7.19



Ubuntu 16.04 LTS




The steps are as follows:




  1. Stop the mysql server service mysql stop

  2. Edit the file /etc/mysql/mysql.conf.d/mysqld.cnf and edit the datadir field to point to new location.



    For example datadir = /data/mysql


  3. Then copy the content of /var/lib/mysql to new location:



    cp -pr /var/lib/mysql /data

  4. Then edit the /etc/apparmor.d/usr.sbin.mysqld file. Remove /var/lib/mysql and add the new datadir location. In my case it is



     # Allow data dir access
    /data/mysql/ r,
    /data/mysql/** rwk,

  5. Restart apparmor service systemctl restart apparmor


  6. Restart the mysql service service mysql start



    The above steps worked for me, I hope it will work for you too.



[#10435] Wednesday, August 31, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
allally

Total Points: 487
Total Questions: 106
Total Answers: 110

Location: Laos
Member since Sun, Jul 3, 2022
2 Years ago
;