From e157f200f820e39b8f42991fabf039daaea106ca Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 21 Jun 2019 14:45:39 +0100 Subject: [PATCH] Clarify the docs on mysql --- readme.md | 2 ++ .../db/mysql/petclinic_db_setup_mysql.txt | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/readme.md b/readme.md index 7dd16246c..a8506b0ee 100644 --- a/readme.md +++ b/readme.md @@ -44,6 +44,8 @@ You could start MySql locally with whatever installer works for your OS, or with docker run -e MYSQL_ROOT_PASSWORD=petclinic -e MYSQL_DATABASE=petclinic -p 3306:3306 mysql:5.7.8 ``` +Further documentation is provided [here](https://github.com/spring-projects/spring-petclinic/blob/master/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt). + ## Working with Petclinic in your IDE ### Prerequisites diff --git a/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt b/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt index d489a1744..6adb900af 100644 --- a/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt +++ b/src/main/resources/db/mysql/petclinic_db_setup_mysql.txt @@ -11,7 +11,19 @@ 1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x), which can be found here: https://dev.mysql.com/downloads/. Or run the "docker-compose.yml" from the root of the project (if you have docker installed - locally). + locally): + + $ docker-compose up + ... + mysql_1_eedb4818d817 | MySQL init process done. Ready for start up. + ... 2) Create the PetClinic database and user by executing the "db/mysql/{schema,data}.sql" - scripts (or set "spring.datasource.initialize=true" the first time you run the app). + scripts (or set "spring.datasource.initialize=always" the first time you run the app). + +3) Run the app with `spring.profiles.active=mysql` (e.g. as a System property via the command + line, but any way that sets that property in a Spring Boot app should work). + +N.B. the "petclinic" database has to exist for the app to work with the JDBC URL value +as it is configured by default. This condition is taken care of by the docker-compose +configuration provided, or by the `schema.sql` if you can run that as root. \ No newline at end of file