Clarify the docs on mysql

This commit is contained in:
Dave Syer 2019-06-21 14:45:39 +01:00
parent 02adb1d49f
commit e157f200f8
2 changed files with 16 additions and 2 deletions

View file

@ -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 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 ## Working with Petclinic in your IDE
### Prerequisites ### Prerequisites

View file

@ -11,7 +11,19 @@
1) Download and install the MySQL database (e.g., MySQL Community Server 5.1.x), 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 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 "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" 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.