Skip to content
mjarek66 edited this page Feb 19, 2016 · 19 revisions

In general MySQL is much slower than H2 in populating tables.


This profile requires:

  • MySQL server running
  • Existence of a database (either empty or populated with both tables and data)

In order to run piLINCS with a database that is already populated on Wen's server I use:

java -jar build/libs/*.jar 
--spring.profiles.active=mysql 
--spring.datasource.url=jdbc:mysql://db5.ketl.uc.edu:3306/pilincs 
--spring.datasource.password=MYPASSWORD

The same in one line:

java -jar build/libs/*.jar --spring.profiles.active=mysql --spring.datasource.url=jdbc:mysql://db5.ketl.uc.edu:3306/pilincs --spring.datasource.password=MYPASSWORD

In order to run piLINCS with a database that needs to be populated I also specify how Hibernate should handle data initialization, so I overwrite default behavior with:

java -jar build/libs/*.jar 
--spring.profiles.active=mysql 
--spring.datasource.url=jdbc:mysql://db5.ketl.uc.edu:3306/pilincs 
--spring.datasource.password=MYPASSWORD
--spring.jpa.hibernate.ddl-auto=create-drop 

By default hibernate.ddl-auto is set in the configuration file to none. Which means that already existing database is used. With create-drop option we repopulate from scratch any specified database that is given at the end of --spring.datasource.url.


TIPS

Some actions you might need to do:

  1. Start MySQL server with sudo service start mysql
  2. Login to MySQL with mysql -u myuser -p
  3. Create a database if it does not exist create database pilincs;
  4. Modify username and password in Yaml configuration file:
    username: your-user
    password: your-password

Please remember about a space after ':'

Now build pilincs with gradle clean build.


If you wish to monitor or preview MySQL server use 'MySQL Workbench'.


In order to create a backup of MySQL database run following in a shell:

mysqldump -u myuser -p pilincs > dump.sql
# You will be asked for a password

In order to restore a database from a backup run in a shell:

mysql -u myuser -p pilincs < dump.sql
# You will be asked for a password