简体   繁体   中英

Error creating db in mysql if not exist by yml file

I am using.yml to set configurations of SQL DB, getting below error while deploying.

"errorMessage": "java.sql.SQLException: The connection property 'createDatabaseIfNotExist' only accepts values of the form: 'true', 'false', 'yes' or 'no'. The value 'true?useUnicode=yes' is not in this set.", "errorType": "liquibase.exception.DatabaseException",

abc.Yml
SPRING_DATASOURCE_URL: "{{ ('jdbc:mysql://%s:%s/%s?createDatabaseIfNotExist=true?useUnicode=yes&characterEncoding=UTF-8' | format(mysql.hostName,mysql.dbPort,dbName)) }}"

I think there is a typo and Java has stated that for you already.

There are two "?" whereas it should be one and rest should be "&" try the below.

SPRING_DATASOURCE_URL: "{{ ('jdbc:mysql://%s:%s/%s?createDatabaseIfNotExist=true&useUnicode=yes&characterEncoding=UTF-8' | format(mysql.hostName,mysql.dbPort,dbName)) }}"

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM