nativeInstallerdolibarr

Modify the MariaDB data directory

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

NOTE: The Approach A sections referred to below do not apply to Bitnami native installers. Users of Bitnami native installers should refer only to the Approach B sections.


NOTE: We are in the process of modifying the configuration for many Bitnami stacks. On account of these changes, the file paths and commands stated in this guide may change depending on whether your Bitnami stack uses MySQL or MariaDB.

Linux and macOS native installer users can identify which database server is used in the stack by running the command below:

 $ test -d installdir/mariadb && echo "MariaDB" || echo "MySQL"

Windows native installer users can identify which database server is used in the stack by checking for the presence of the installdir/mariadb directory. If present, the installer uses MariaDB and if not, it uses MySQL.

Depending on which database server (MySQL or MariaDB) is used by the installation, use the appropriate guides in our documentation for database-related operations.

Approach A: Bitnami installations using system packages

  • Bitnami installations that use system packages contain the MariaDB data at the /bitnami/mariadb/data directory, by default. Check it by running the following command:

      $ cat installdir/scripts/mariadb-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/mariadb.

  • To change the location of the MariaDB data directory, modify the installdir/scripts/mariadb-env.sh file as shown below:

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

Approach B: Self-contained Bitnami installations

  • For self-contained Bitnami stacks, the data directory for MariaDB is located at installdir/mariadb/data by default. To change the location of this folder, modify the installdir/mariadb/my.cnf file as shown below:

      ...
      datadir=installdir/mariadb/data
      ...
    
  • Modify the installdir/mariadb/scripts/ctl.sh file to reflect the new directory location:

      --datadir=installdir/mariadb/data
    
  • Finally, move the data/ directory to the new location and restart the database.

Last modification July 26, 2021