• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to change the audit log path in the MySQL Docker

by admin

1. Here we use 5.7.29 Docker image as an example.

$ docker load -i mysql-enterprise-server-5.7.29.tar

2. You can bind OS mounts to Docker directory, assume you want to keep the audit logs under /bak/logs directory on the host.

$ docker run --name=mysql1 \
--mount type=bind,src=/bak/my.cnf,dst=/etc/my.cnf \
--mount type=bind,src=/bak/data,dst=/var/lib/mysql \
--mount type=bind,src=/bak/logs,dst=/var/lib/logs \
-d mysql/enterprise-server:5.7

3. Start the mysql:

$ docker start mysql1

4. Start the Docker shell and install the audit log plugin:

$ docker exec -it mysql1 bash

shell> mysql -uroot -ppassword
mysql> source /usr/share/mysql/audit_log_filter_linux_install.sql

5. If you want to change the location of audit log, modify the my.cnf file:

[mysqld]

....

loose_audit_log_file=/var/lib/logs/audit.log

Filed Under: DevOps, Docker, mysql

Some more articles you might also be interested in …

  1. MySQL Grants – Setting User Permissions On Different Tables
  2. How to backup and restore Docker containers
  3. Docker Troubleshooting – “conflict: unable to delete, image is being used by running container”
  4. What are Reserved User Accounts in MySQL
  5. How to Access Docker Container’s Network Namespace from Host
  6. MySQL Fails to Start Using systemctl On systemd Linux Distributions
  7. “su: Authentication failure” – in Docker
  8. How to install and configure MySQL sys schema
  9. How To Skip a Transaction on MySQL replication slave When GTIDs Are Enabled
  10. How to update/add a file in the Docker Image

You May Also Like

Primary Sidebar

Recent Posts

  • ctags: Generates an index (or tag) file of language objects found in source files for many popular programming languages
  • csvtool: Utility to filter and extract data from CSV formatted sources
  • csvstat: Print descriptive statistics for all columns in a CSV file
  • csvsql: Generate SQL statements for a CSV file or execute those statements directly on a database

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright