简体   繁体   English

如何从 mysql-connector 切换到 mariadb?

[英]How to switch from mysql-connector to mariadb?

I'm switching from mysql-connector-java to mariadb-java-client .我正在从mysql-connector-java切换到mariadb-java-client

Question:题:

1) Is it a problem if the underlying database is still a mysql database? 1)如果底层数据库还是mysql数据库是不是有问题?

2) Is it valid to use jdbc:mariadb as the url, even if the underlying db is still mysql? 2) 使用jdbc:mariadb作为 url 是否有效,即使底层 db 仍然是 mysql?

3) I'm relying on spring-boot to create an initial HikariDataSource connection pool. 3)我依靠spring-boot创建一个初始的HikariDataSource连接池。 Do I have to disable the internal mariadb-client connection pool?我是否必须禁用内部 mariadb-client 连接池?

Eg:例如:

spring.datasource.url=jdbc:mariadb://localhost/tablename
spring.datasource.username=root
spring.datasource.password=
spring.datasource.hikari.minimum-idle=1
spring.datasource.hikari.maximum-pool-size=10

1) Is it a problem if the underlying database is still a mysql database? 1)如果底层数据库还是mysql数据库是不是有问题?

It is usually not a problem (unless you're using 8.0 with shiny new caching_sha2_password authentication).这通常不是问题(除非您使用具有全新 caching_sha2_password 身份验证的 8.0)。

2) Is it valid to use jdbc:mariadb as the url, even if the underlying db is still mysql? 2) 使用 jdbc:mariadb 作为 url 是否有效,即使底层 db 仍然是 mysql?

Yes, it is valid.是的,它是有效的。 The only reason for jdbc:mariadb is that it helps to predictably load MariaDB's driver, even if MySQL's is also in classpath jdbc:mariadb 的唯一原因是它有助于可预测地加载 MariaDB 的驱动程序,即使 MySQL 也在类路径中

3) I'm relying on spring-boot to create an initial HikariDataSource connection pool. 3)我依靠 spring-boot 创建一个初始的 HikariDataSource 连接池。 Do I have to disable the internal mariadb-client connection pool?我是否必须禁用内部 mariadb-client 连接池?

If you did not enable driver's internal pool, it is not used.如果您没有启用驱动程序的内部池,则不会使用它。 But maybe you should give internal pooling a try.但也许您应该尝试内部池化。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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