3. Linux machines - Migrate data from MySQL to PostgreSQL


  • Follow this instruction to create a Backup of both your PostgreSQL(Sessions) and MySQL(qTest) databases before attempting to migrate
  1. Download the migration tool to your local machine
  2. $ wget https://qtest-storage.s3.amazonaws.com/archive/qtest-onpremise-postgres-migration/0.0.1/qtest-onpremise-postgres-migration-0.0.1.tar.gz
  3. Extract the downloaded package
    $ tar -zxf qtest-onpremise-postgres-migration-0.0.1.tar.gz
  4. Access to the extracted folder above
    $ cd qtest-onpremise-postgres-migration-0.0.1
  5. Open file application.properties
    $ vim application.properties
  6. Edit the following required information
    #Replace clientdb2 with the name of your current qTest 7.7.3 MySQL database
    #MySQL database host address
    #MySQL listen port(Default 3306)
    #clientdb2clone - Name of MySQL database clone that will be created to migrate data to PostgreSQL.
    #MySQL user, this user must be granted create database privileges.
    #MySQL password

    # PostgreSQL server host address
    # PostgreSQL listen port(default 5432)
    # PostgreSQL database that will be created during this migration
    # PostgreSQL User, this user must be granted create database privileges
    # PostgreSQL Password

    # This database must already exist, it is used to log into postgres and create the destination.database
    Key Description
    datasource.source.originDatabase Name of your qTest's database on MySQL
    datasource.source.host IP of your MySQL server
    datasource.source.port Port number of your MySQL server
    datasource.source.database Enter a non-existing database name on your MySQL server. The tool will clone the datasource.source.originDatabase to datasource.source.database and it will migrate data in the clone database
    datasource.source.username User name to log in to your MySQL server
    datasource.source.password Password to login to your MySQL server
    datasource.destination.host IP of your PostgreSQL server
    datasource.destination.port Port number of your PostgreSQL server
    datasource.destination.database Name of a non-existing PostgreSQL database where the data will be migrated to
    datasource.destination.username User name to log in to your PostgreSQL server
    datasource.destination.password Password to log in to your PostgreSQL server
    datasource.predestination.database Enter any existing database which can be accessed by the above PostgreSQL credentials. It is needed so that the tool can create a new database in Postgres. The tool will not use its data
  7. After you have done modifying the file, save and close it
  8. Run the following command to start the migration process

    java -jar qtest-onpremise-postgres-migration-0.0.1.jar
  9. After the progress is completed, your qTest database in MySQL is migrated to PostgreSQL as defined in the table above and a back-up of your MySQL database is downloaded to your local machine in the same location with the executed jar file