Setting up your MySQL database manually

IBM Worklight V5.0.5. automatically configures your databases. However, if you are using an older version of IBM Worklight, or if you are experiencing problems with the automatic configuration process, you must manually set up and configure your MySQL database. Complete the following procedure to set up your MySQL database.

  1. Create the database schema.

    1. Run a MySQL command-line client.

    2. Enter the following commands:
      CREATE DATABASE WRKLGHT CHARACTER SET utf8 COLLATE utf8_general_ci;
      GRANT ALL privileges ON WRKLGHT.* TO 'worklight'@'Worklight-host' IDENTIFIED BY 'worklight';
      GRANT ALL privileges ON WRKLGHT.* TO 'worklight'@'localhost' IDENTIFIED BY 'worklight';
      Flush privileges;
      CREATE DATABASE WLREPORT CHARACTER SET utf8 COLLATE utf8_general_ci;
      GRANT ALL privileges ON WLREPORT.* TO 'worklight'@'Worklight-host'IDENTIFIED BY 'worklight';
      GRANT ALL privileges ON WLREPORT.* TO 'worklight'@'localhost' IDENTIFIED BY 'worklight';
      Flush privileges;
      
      USE WRKLGHT;
      SOURCE <worklight_install_dir>/WorklightServer/databases/create-worklight-mysql.sql;
      
      USE WLREPORT;
      SOURCE <worklight_install_dir>/WorklightServer/databases/create-worklightreports-mysql.sql;
      

      Where Worklight-host is the name of the host on which IBM Worklight runs.

  2. Create a worklight.properties file. Give the file the following contents, depending on whether you are using JDBC or JNDI:

    1. JDBC version:
      wl.db.type=MYSQL
      wl.db.url=jdbc:mysql://localhost:3306/WRKLGHT
      wl.reports.db.type=MYSQL
      wl.reports.db.url=jdbc:mysql://localhost:3306/WLREPORT
      wl.db.username=worklight
      wl.db.password=worklight
      reports.exportRawData=true
      

    2. JNDI version:
      wl.db.jndi.name=jdbc/WorklightDS
      wl.db.type=MYSQL
      wl.reports.db.jndi.name=jdbc/WorklightReportsDS
      wl.reports.db.type=MYSQL
      reports.exportRawData=true
      

  3. Add the following property to your MySQL option file: max_allowed_packet=16M

    For more information about option files, see theMySQL documentation at MySQL.

  4. Replace the WEB-INF/classes/conf.worklight.properties file in worklight.war with the file you created in the previous step.

    If you do not already have the MySQL driver Connector/J, download it from Download Connector/J. The driver is supplied as a compressed file. Extract the .jar file from it.


Parent topic Troubleshooting