Reputation: 173
I am working on a POC where I am trying to change the transaction log files in MySQL 8.0. From my findings, I think ib_logfile0 and ib_logfile1 are the files that I should be concerned with (Are there any other files that I should be considering ?). In order to do that, based on the instructions on this page, I am trying to do the following :
sudo systemctl stop mysql
innodb_log_group_home_dir = "/media/newdisk/iblogs"
in /etc/mysql/mysql.conf.d/mysqld.cnf
sudo systemctl start mysql
However, this did not seem to work. The start in Step 3 is failing. I have tried the following but none of these helped.
sudo systemctl restart apparmor
/media/newdisk
is where I have the external disk. I created the
iblogs
directory and assigned RWX(777) permissions on it. sudo chown -R mysql:mysql /media/newdisk
ib_logfile0
and ib_logfile1
currently in /var/lib/mysql
(default
datadir) to /media/newdisk/iblogs
Should I also consider adding an alias in the apparmor cnf ? If yes, I dont quite get what should be my alias. Some examples I have taken a look at has the entire data directory pointing to the new location as a result of which they have set the alias for /var/lib/mysql
to the new directory. But I am only concerned with the ib_logile*.
Tried the above approach using this solution ,but that did not work.
Upvotes: 0
Views: 2075
Reputation: 173
Thanks to the link provided by @Bill Karwin above. https://ubuntu.com/tutorials/beginning-apparmor-profile-development#1-overview
This is how I was able to solve the issue and successfully update just the log directory
Upvotes: 1
Reputation: 562348
Apparmor often disallows services like mysqld from accessing files that are not in the prescribed locations. There should be a profile file for the mysqld service, that you need to update with the new location of your ib logfiles.
The symptom may be a report in the MySQL error log that it can't open the ib log file, either because of permission problems or because the file doesn't exist. This might be confusing, because there's no reason why these should be problems, except for apparmor.
You can also try shutting down apparmor completely as a test. If you can start MySQL Server successfully while apparmor is off, this is evidence that apparmor is blocking the file access.
You might like to read about using or modifying apparmor profiles: https://ubuntu.com/tutorials/beginning-apparmor-profile-development#1-overview
Upvotes: 1