Please Note This forum exists for community support for the Mango product family and the Radix IoT Platform. Although Radix IoT employees participate in this forum from time to time, there is no guarantee of a response to anything posted here, nor can Radix IoT, LLC guarantee the accuracy of any information expressed or conveyed. Specific project questions from customers with active support contracts are asked to send requests to support@radixiot.com.

Radix IoT Website Mango 3 Documentation Website Mango 4 Documentation Website

Convert from H2 to mySQL Database guidelines


  • Hello everyone,
    I followed the guidelines on this page. But I could not create the mySQL database.
    I downloaded "Mango Automation 3.4.3 Free", I started it, I accepted the license and then I closed mango and proceeded to modify the env.properties file.

    convert.db.type=mysql
    convert.db.url=${ma.home}/databases/mySQLMango
    convert.db.username=admin
    convert.db.password=admin

    When I restart mango, the page loading stops and a H2 db is generated even though I had deleted it before starting the application

    Could you explain the procedure step by step?
    Thanks in advance


  • @pierjsap said in Convert from H2 to mySQL Database guidelines:

    to modify the env.properties file.

    Which env.properties file? There should be two, one in ${MA_HOME}/classes and another in ${MA_HOME}/overrides/properties which is the one you should be modifying.


  • @jared-wiltshire said in Convert from H2 to mySQL Database guidelines:

    ${MA_HOME}/overrides/properties I modified this, only that I would need explicit help because I have no idea how to port mysql. I did various tests without results.

    Thanks @Jared-Wiltshire


  • Hi pierjsap,

    You need to have installed a MySQL server for Mango to connect to, and created a database with a properly privileged user, before you can convert your existing H2 database.

    Once you have that, you will use this section of the env.properties to connect to MySQL (you need to remove the # before the property or it is a comment!):

    # MySQL database settings. Your MySQL instance must already be running and configured before this can be used.
    #db.type=mysql
    #db.url=jdbc:mysql://localhost:3306/<your mysql schema name>
    #db.username=<your mysql username>
    #db.password=<your mysql password>
    #db.mysqldump=<location/command for mysqldump executable for backups>
    #db.mysql=<location/command for mysql executable for restore>
    

    "mysql schema name" == "database name" there, with this MySQL server installed on the same machine Mango is on.

    and then in the convert properties you have shown you need to use your H2 settings to identify the database to convert. It's a good idea to comment these lines back out after the conversion, but it will not convert it twice by itself. Probably,

    convert.db.type=h2
    convert.db.url=jdbc:h2:${ma.home}/databases/mah2
    convert.db.username=
    convert.db.password=
    

  • @phildunlap said in Convert from H2 to mySQL Database guidelines:

    You need to have installed a MySQL server for Mango to connect to, and created a database with a properly privileged user, before you can convert your existing H2 database.

    You need to have installed a MySQL server for Mango to connect to, and created a database with a properly privileged user, before you can convert your existing H2 database.

    @phildunlap for created database do you mean to create an empty database? or do I have to run some script for the generation of the db with mySQL Server?


  • mysql -u root -p
    <enter password>
    create database mango;
    create user mangoUser;
    grant all privileges on mango.* to 'mangoUser'@'%' identified by 'mangoUserPassword';
    
    db.type=mysql
    db.url=jdbc:mysql://localhost:3306/mango
    db.username=mangoUser
    db.password=mangoUserPassword
    db.mysqldump=/usr/bin/mysqldump
    db.mysql=/usr/bin/mysql
    

    Note that your URL may be influenced by the MySQL server's bind address.


  • Thank so much @Jared-Wiltshire and @phildunlap ;)