Configure Liberty profile for MySQL manually
To manually set up and configure the MySQL database with WAS Liberty profile, use the following procedure.
Complete the MySQL database setup procedure before continuing.
- Add the MySQL JDBC driver JAR file to $LIBERTY_HOME/wlp/usr/shared/resources/mysql. If that directory does not exist, create it.
- Configure the data source in the $LIBERTY_HOME/usr/servers/worklightServer/server.xml file (worklightServer may be replaced in this path by the name of the server) as follows:
<!-- Declare the jar files for MySQL access through JDBC. --> <library id="MySQLLib"> <fileset dir="${shared.resource.dir}/mysql" includes="*.jar"/> </library> <!-- Declare the Worklight Server project database --> <dataSource jndiName="worklight/jdbc/WorklightDS" transactional="false"> <jdbcDriver libraryRef="MySQLLib"/> <properties databaseName="WRKLGHT" serverName="mysqlserver" portNumber="3306" user="worklight" password="password"/> </dataSource> <!-- Declare the Worklight Server reports database --> <dataSource jndiName="worklight/jdbc/WorklightReportsDS" transactional="false"> <jdbcDriver libraryRef="MySQLLib"/> <properties databaseName="WLREPORT" serverName="mysqlserver" portNumber="3306" user="worklight" password="password"/> </dataSource>Where worklight after user= is the user name, password after password= is this user's password, and mysqlserver is the host name of the MySQL server. If we have defined either a different user name, or a different password, or both, replace these entries accordingly. Also, replace mysqlserver with the host name of the MySQL server (for example, localhost, if it is on the same machine).
The database user provided in this step does not need extended privileges on the databases. If we need to implement restrictions on the database, we can set here a user that has the restricted privileges listed in Restrict database user permissions for runtime operations.
The jndiName attributes must depend on the context root that you select for the MobileFirst Server application, following the instructions in Configure the Liberty profile manually. If the context root is /app_context, use jndiName="app_context/jdbc/WorklightDS" and jndiName="app_context/jdbc/WorklightReportsDS" respectively.
Parent topic: Configure the MySQL databases manually