Skip to main content

Restore database backups

Use this procedure to restore the MySQL database that the Contrast installer creates.

This procedure does not apply to MySQL databases that you create for distributed environments.

Before you begin

Database restoration should be performed by a MySQL Database Administrator.


  1. Use the encrypted properties editor to identify the MySQL database settings.

  2. Shut down Contrast.

  3. Start up MySQL individually using the MySQL service packaged with Contrast. Replace <YourPath> with the path to your Contrast home.

    • Windows:

      "<YourPath>\mysql\bin\mysqld.exe" --defaults-file="<YourPath>\data\conf\my.cnf"
    • Linux:

      sudo -u contrast_service <YourPath>/mysql/bin/mysqld --defaults-file=<YourPath>/data/conf/my.cnf --basedir=<YourPath>/mysql --datadir=<YourPath>/data/db --plugin-dir=<YourPath>/mysql/lib/plugin --lc-messages-dir=<YourPath>/mysql/share --tmpdir=/tmp --lc-messages=en_US --log-error=<YourPath>/logs/mysql_error.log --pid-file=<YourPath>/data/proc/ --port=13306
  4. Connect to MySQL. Replace <>, <jdbc.port>, <jdbc.user> and <jdbc.schema> with your host, port, user and schema.

    • Windows:

      mysql -h <> -P <jdbc.port> -u <jdbc.user> -p <jdbc.schema>
    • Linux:

      ./mysql -h <> -P <jdbc.port> -u <jdbc.user> -p <jdbc.schema>
  5. Drop the Contrast database with drop database <jdbc.schema>;.

  6. Create the Contrast database with create database <jdbc.schema>;.

  7. Grant permissions to the Contrast user with GRANT ALL PRIVILEGES ON *.* to 'contrast'@'%';.

  8. Exit from MySQL.

  9. Restore the MySQL backup. Replace <backup_location> with your backup location and <backup_filename> with your backup filename.

    • Windows:

      mysql -h <> -P <jdbc.port> -u <jdbc.user> -p <jdbc.schema> < <backup_location>/<backup_filename>
    • Linux:

      ./mysql -h <> -P <jdbc.port> -u <jdbc.user> -p <jdbc.schema> < <backup_location>/<backup_filename>
  10. Shut down MySQL:

    • Windows:

      Use the Windows Service Manager application to shut down the MySQL service.

    • Linux:

      $CONTRAST_HOME/mysql/bin/mysqladmin.exe shutdown -h localhost -P 13306 -u contrast -p

      You are prompted for the password that is set in the encrypted properties editor.

  11. Restart the fully-restored Contrast and MySQL together.