user5566364
user5566364

Reputation: 173

Changing ib_logfile* directory in MySQL 8.0 by updating innodb_log_group_home_dir

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 :

  1. Stop mysql.sudo systemctl stop mysql
  2. Add the line innodb_log_group_home_dir = "/media/newdisk/iblogs" in /etc/mysql/mysql.conf.d/mysqld.cnf
  3. Start mysql. 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.

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

Answers (2)

user5566364
user5566364

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

  1. Stop mySQL.
  2. Stop Apparmor.
  3. Add the desired directory in mysqld.cnf
  4. Give permissions of the desired directory in usr.sbin.mysqld (mysql profile)
  5. Start apparmor.
  6. Start mySQL;

Upvotes: 1

Bill Karwin
Bill Karwin

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

Related Questions