How to use and configure an external database with Squash TM?

Squash TM comes with an embedded H2 database for testing purpose only. To use it in production, we advise to connect Squash TM to a MySQL or PostgreSQL database.

 

 

Use a MySQL database

Step 1: Configure MySQL

  • Create a new database with UTF8 encoding for Squash TM, and grant all rights on this database for a user:
    CREATE DATABASE IF NOT EXISTS squashtm CHARACTER SET utf8 COLLATE utf8_bin;
    CREATE USER 'squash-tm'@'localhost' IDENTIFIED BY 'my_password';
    GRANT ALL ON squashtm.* TO 'squash-tm'@'localhost';
    FLUSH PRIVILEGES;
  • Create a user with the select/insert/update/delete/create temporary tables on this database.
  • Check the following information in the MySQL configuration file (my.cnf ou my.ini):
    • default-storage-engine = InnoDB
    • max_allowed_packet=X (where X is the max authorized size of attachments by Squash. By default, the application is set to 2Mo,ie X=2M)
    • Restart MySQL

Step 2: Populate Squash TM database

  • Use the script 'mysql-full-install.sql' found in the folder 'database-scripts/' of the Squash TM package to populate the database you just created (the database administrator executing this script must have SUPER privilege).

Step 3: Configure Squash TM to use the MySQL database

  • Edit the following parameters in the startup file:
    DB_TYPE=mysql
    DB_URL=jdbc:mysql://localhost:3306/squashtm
    DB_USERNAME= squash-tm
    DB_PASSWORD=my_password

Step 4 : Launch Squash TM

  • Restart Squash TM
  • Log on Squash TM with default administrator login admin/admin

 

 

Use a PostgreSQL database

Step 1: Configure PostgreSQL

  • Create a new database with UTF8 encoding for Squash TM, and grant all rights on this database for a user:
    CREATE DATABASE squashtm WITH ENCODING='UTF8';
    CREATE USER squash-tm WITH PASSWORD 'my_password';
    GRANT ALL PRIVILEGES ON DATABASE squashtm TO squash-tm;


Step 2: Populate Squash TM database

  • Use the script 'postgresql-full-install.sql' found in the folder 'database-scripts/' of the Squash TM package to populate the database you just created (the database administrator executing this script must have SUPER privilege).

Step 3: Configure Squash TM to use the PostgreSQL database

  • Edit the following parameters in the startup file:
    DB_TYPE=postgresql
    DB_URL=jdbc:postgresql://localhost:5432/squashtm
    DB_USERNAME= squash-tm
    DB_PASSWORD=my_password

Step 4 : Launch Squash TM

  • Restart Squash TM
  • Log on Squash TM with default administrator login admin/admin