virtualMachinemysql

Modify the MySQL data directory

  • Bitnami installation that use system packages contain the MySQL data at the /bitnami/mysql/data directory, by default. Check it by running the following command:

      $ cat /opt/bitnami/scripts/mysql-env.sh | grep DB_DATA_DIR
      export DB_DATA_DIR="${DB_VOLUME_DIR}/data"
    

    NOTE: The DB_VOLUME_DIR environment variable is set to /bitnami/mysql.

  • To change the location of the MySQL data directory, modify the /opt/bitnami/scripts/mysql-env.sh file as shown below:

      ...
      export DB_DATA_DIR=/bitnami/mysql/data
      ...
    
  • Finally, move the data/ directory to the new location and restart the database.

Last modification February 9, 2023