如何使用 UTF-8 字符集的 liquibase 创建数据库
How to create database with liquibase in UTF-8 character set
使用 Jhipster (Spring) 和 Liquibase,我希望 liquibase 在不存在的情况下创建我的数据库,我希望它采用 UTF-8 格式。
这是我的 "application-dev.yml" 配置文件的示例。
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://127.0.0.1:3306/scalink?useUnicode=true&characterEncoding=utf8&useSSL=false&createDatabaseIfNotExist=true
name:
username: root
password:
hikari:
data-source-properties:
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
我现在的问题是:我哪里错了?
感谢大家。
亚历克斯
据此Liquibase CORE-50 the creation of the database is not a task for Liquibase. Trying to create the database over the datasource url with the parameter createDatabaseIfNotExist=true is just an option which is offered by the JDBC driver. Unfortunately creating a database this way is limited in option. Also the documentation不提供更多信息。如果您仍想按照您提到的方式创建数据库,可以让数据库在 JDBC url 上创建,然后在 [=16= 中添加一个 changeSet ].xml 正在将架构更改为 utf8
<changeSet id="0" author="jhipster">
<sql>ALTER SCHEMA `jhipstersampleapplication` DEFAULT CHARACTER SET utf8;
</sql>
</changeSet>
使用 Jhipster (Spring) 和 Liquibase,我希望 liquibase 在不存在的情况下创建我的数据库,我希望它采用 UTF-8 格式。
这是我的 "application-dev.yml" 配置文件的示例。
datasource:
type: com.zaxxer.hikari.HikariDataSource
url: jdbc:mysql://127.0.0.1:3306/scalink?useUnicode=true&characterEncoding=utf8&useSSL=false&createDatabaseIfNotExist=true
name:
username: root
password:
hikari:
data-source-properties:
cachePrepStmts: true
prepStmtCacheSize: 250
prepStmtCacheSqlLimit: 2048
useServerPrepStmts: true
我现在的问题是:我哪里错了?
感谢大家。
亚历克斯
据此Liquibase CORE-50 the creation of the database is not a task for Liquibase. Trying to create the database over the datasource url with the parameter createDatabaseIfNotExist=true is just an option which is offered by the JDBC driver. Unfortunately creating a database this way is limited in option. Also the documentation不提供更多信息。如果您仍想按照您提到的方式创建数据库,可以让数据库在 JDBC url 上创建,然后在 [=16= 中添加一个 changeSet ].xml 正在将架构更改为 utf8
<changeSet id="0" author="jhipster">
<sql>ALTER SCHEMA `jhipstersampleapplication` DEFAULT CHARACTER SET utf8;
</sql>
</changeSet>