• 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. EFS Mount Issue “Failed to resolve server: Name or service not known”
  2. Understanding MySQL Privileges
  3. MySQL: How to Set Account Resource Limits
  4. How to resolve Docker Search Command Error – “getsockopt: no route to host” in CentOS / RHEL / Fedora
  5. How to use “break” and “continue” statements in shell scripts
  6. “Error: Could Not Find A Ready Tiller Pod” – helm error
  7. MySQL: How to kill a Long Running Query using max_execution_time
  8. Using Loops (while, for) in awk scripts
  9. What is an Arbitrator in MySQL Cluster
  10. mysqldump – How to Restore a Specific Database From a Backup of All Databases

You May Also Like

Primary Sidebar

Recent Posts

  • netselect-apt Command Examples in Linux
  • netselect-apt: command not found
  • nethogs Command Examples in Linux
  • nethogs: command not found

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright