尝试使用springboot+Mybatis连接tidb报错Table 'information_schema.KEYWORDS' doesn't exist

【 TiDB 使用环境】测试
【 TiDB 版本】V7.5.0
【复现路径】原先数据库选用mysql,并无异常,然后安装了tidb, 部署本地测试集群,通过navicat 迁移数据库,修改jdbc路径为tidb的路径。(未变更mysql驱动),报错Table ‘information_schema.KEYWORDS’ doesn’t exist
【遇到的问题:问题现象及影响】
【资源配置】进入到 TiDB Dashboard -集群信息 (Cluster Info) -主机(Hosts) 截图此页面
【附件:截图/日志/监控】
16:15:09.650 [main] DEBUG o.s.c.e.PropertySourcesPropertyResolver TID: N/A - [logKeyFound,115] - Found key ‘spring.liveBeansView.mbeanDomain’ in PropertySource ‘systemProperties’ with value of type String
Spring Boot Version: 2.3.12.RELEASE
Spring Application Name: ${spring.application.name}
16:15:11.485 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder TID: N/A - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[psf-system-foundation] & group[DEFAULT_GROUP]
16:15:11.489 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder TID: N/A - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[psf-system-foundation.yml] & group[DEFAULT_GROUP]
16:15:11.492 [main] WARN c.a.c.n.c.NacosPropertySourceBuilder TID: N/A - [loadNacosData,87] - Ignore the empty nacos configuration and get it based on dataId[psf-system-foundation-local.yml] & group[DEFAULT_GROUP]
16:15:11.520 [main] INFO c.n.NtFoundationApplication TID: N/A - [logStartupProfileInfo,652] - The following profiles are active: local
16:15:13.675 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate TID: N/A - [multipleStoresDetected,249] - Multiple Spring Data modules found, entering strict repository configuration mode!
16:15:13.675 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate TID: N/A - [registerRepositoriesIn,127] - Bootstrapping Spring Data JPA repositories in DEFAULT mode.
16:15:13.845 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate TID: N/A - [registerRepositoriesIn,187] - Finished Spring Data repository scanning in 161ms. Found 0 JPA repository interfaces.
16:15:13.865 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate TID: N/A - [multipleStoresDetected,249] - Multiple Spring Data modules found, entering strict repository configuration mode!
16:15:13.867 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate TID: N/A - [registerRepositoriesIn,127] - Bootstrapping Spring Data Redis repositories in DEFAULT mode.
16:15:14.007 [main] INFO o.s.d.r.c.RepositoryConfigurationDelegate TID: N/A - [registerRepositoriesIn,187] - Finished Spring Data repository scanning in 123ms. Found 0 Redis repository interfaces.
16:15:14.117 [main] WARN o.s.b.a.e.EndpointId TID: N/A - [logWarning,155] - Endpoint ID ‘service-registry’ contains invalid characters, please migrate to a valid format.
16:15:14.368 [main] INFO o.s.c.c.s.GenericScope TID: N/A - [setSerializationId,295] - BeanFactory id=64c29a7d-f2ec-373b-8069-0cfe2b3209ad
16:15:14.405 [main] INFO c.u.j.c.EnableEncryptablePropertiesBeanFactoryPostProcessor TID: N/A - [postProcessBeanFactory,40] - Post-processing PropertySource instances
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource bootstrapProperties-psf-system-foundation-local.yml,DEFAULT_GROUP [org.springframework.cloud.bootstrap.config.BootstrapPropertySource] to EncryptableEnumerablePropertySourceWrapper
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource bootstrapProperties-psf-system-foundation.yml,DEFAULT_GROUP [org.springframework.cloud.bootstrap.config.BootstrapPropertySource] to EncryptableEnumerablePropertySourceWrapper
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource bootstrapProperties-psf-system-foundation,DEFAULT_GROUP [org.springframework.cloud.bootstrap.config.BootstrapPropertySource] to EncryptableEnumerablePropertySourceWrapper
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource bootstrapProperties-application-test.yml,DEFAULT_GROUP [org.springframework.cloud.bootstrap.config.BootstrapPropertySource] to EncryptableEnumerablePropertySourceWrapper
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,76] - Skipping PropertySource configurationProperties [class org.springframework.boot.context.properties.source.ConfigurationPropertySourcesPropertySource
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,76] - Skipping PropertySource servletConfigInitParams [class org.springframework.core.env.PropertySource$StubPropertySource
16:15:14.406 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,76] - Skipping PropertySource servletContextInitParams [class org.springframework.core.env.PropertySource$StubPropertySource
16:15:14.407 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource systemProperties [org.springframework.core.env.PropertiesPropertySource] to EncryptableMapPropertySourceWrapper
16:15:14.407 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource systemEnvironment [org.springframework.boot.env.SystemEnvironmentPropertySourceEnvironmentPostProcessor$OriginAwareSystemEnvironmentPropertySource] to EncryptableSystemEnvironmentPropertySourceWrapper
16:15:14.407 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource random [org.springframework.boot.env.RandomValuePropertySource] to EncryptablePropertySourceWrapper
16:15:14.407 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource springCloudClientHostInfo [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
16:15:14.407 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource springCloudDefaultProperties [org.springframework.core.env.MapPropertySource] to EncryptableMapPropertySourceWrapper
16:15:14.407 [main] INFO c.u.j.EncryptablePropertySourceConverter TID: N/A - [makeEncryptable,81] - Converting PropertySource cachedrandom [org.springframework.cloud.util.random.CachedRandomPropertySource] to EncryptablePropertySourceWrapper
16:15:14.808 [main] INFO o.s.c.s.PostProcessorRegistrationDelegate$BeanPostProcessorChecker TID: N/A - [postProcessAfterInitialization,335] - Bean ‘com.netintech.common.redis.configure.RedisConfig’ of type [com.netintech.common.redis.configure.RedisConfig$$EnhancerBySpringCGLIB$$35e527dd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
16:15:15.098 [main] INFO c.u.j.f.DefaultLazyPropertyFilter TID: N/A - [lambda$new$2,31] - Property Filter custom Bean not found with name ‘encryptablePropertyFilter’. Initializing Default Property Filter
16:15:15.106 [main] INFO c.u.j.r.DefaultLazyPropertyResolver TID: N/A - [lambda$new$2,35] - Property Resolver custom Bean not found with name ‘encryptablePropertyResolver’. Initializing Default Property Resolver
16:15:15.106 [main] INFO c.u.j.d.DefaultLazyPropertyDetector TID: N/A - [lambda$new$2,35] - Property Detector custom Bean not found with name ‘encryptablePropertyDetector’. Initializing Default Property Detector
16:15:15.398 [main] INFO o.s.b.w.e.t.TomcatWebServer TID: N/A - [initialize,108] - Tomcat initialized with port(s): 9301 (http)
16:15:15.413 [main] INFO o.a.c.h.Http11NioProtocol TID: N/A - [log,173] - Initializing ProtocolHandler [“http-nio-9301”]
16:15:15.414 [main] INFO o.a.c.c.StandardService TID: N/A - [log,173] - Starting service [Tomcat]
16:15:15.414 [main] INFO o.a.c.c.StandardEngine TID: N/A - [log,173] - Starting Servlet engine: [Apache Tomcat/9.0.46]
16:15:15.623 [main] INFO o.a.c.c.C.[.[.[/] TID: N/A - [log,173] - Initializing Spring embedded WebApplicationContext
16:15:15.624 [main] INFO o.s.b.w.s.c.ServletWebServerApplicationContext TID: N/A - [prepareWebApplicationContext,285] - Root WebApplicationContext: initialization completed in 4069 ms
16:15:15.771 [main] INFO c.u.j.e.DefaultLazyEncryptor TID: N/A - [lambda$new$2,37] - String Encryptor custom Bean not found with name ‘jasyptStringEncryptor’. Initializing Default String Encryptor
16:15:15.787 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.key-obtention-iterations, using default value: 1000
16:15:15.787 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.pool-size, using default value: 1
16:15:15.788 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.provider-name, using default value: null
16:15:15.788 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.provider-class-name, using default value: null
16:15:15.788 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.salt-generator-classname, using default value: org.jasypt.salt.RandomSaltGenerator
16:15:15.790 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.iv-generator-classname, using default value: org.jasypt.iv.RandomIvGenerator
16:15:15.791 [main] INFO c.u.j.c.StringEncryptorBuilder TID: N/A - [get,102] - Encryptor config not found for property jasypt.encryptor.string-output-type, using default value: base64
16:15:16.612 [main] INFO org.redisson.Version TID: N/A - [logVersion,41] - Redisson 3.15.6
16:15:17.512 [redisson-netty-2-15] INFO o.r.c.p.MasterPubSubConnectionPool TID: N/A - [lambda$run$0,166] - 1 connections initialized for 172.16.1.194/172.16.1.194:6379
16:15:18.521 [redisson-netty-2-19] INFO o.r.c.p.MasterConnectionPool TID: N/A - [lambda$run$0,166] - 24 connections initialized for 172.16.1.194/172.16.1.194:6379
16:15:18.830 [main] INFO c.z.h.HikariDataSource TID: N/A - [getConnection,110] - HikariPool-1 - Starting…
16:15:19.056 [main] INFO c.z.h.HikariDataSource TID: N/A - [getConnection,123] - HikariPool-1 - Start completed.
16:15:19.220 [main] INFO o.h.j.i.u.LogHelper TID: N/A - [logPersistenceUnitInformation,31] - HHH000204: Processing PersistenceUnitInfo [name: default]
16:15:19.329 [main] INFO o.hibernate.Version TID: N/A - [logVersion,44] - HHH000412: Hibernate ORM core version 5.4.32.Final
16:15:19.519 [main] INFO o.h.a.common.Version TID: N/A - [,56] - HCANN000001: Hibernate Commons Annotations {5.1.2.Final}
16:15:19.733 [main] INFO o.h.dialect.Dialect TID: N/A - [,175] - HHH000400: Using dialect: org.hibernate.dialect.MySQL8Dialect
16:15:19.782 [main] WARN o.h.e.j.e.i.JdbcEnvironmentInitiator TID: N/A - [initiateService,121] - HHH000339: Could not obtain connection metadata: java.sql.SQLSyntaxErrorException: Table ‘information_schema.KEYWORDS’ doesn’t exist
java.sql.SQLSyntaxErrorException: Table ‘information_schema.KEYWORDS’ doesn’t exist
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
at com.mysql.cj.jdbc.exceptions.SQLExceptionsMapping.translateException(SQLExceptionsMapping.java:122)
at com.mysql.cj.jdbc.StatementImpl.executeQuery(StatementImpl.java:1198)
at com.mysql.cj.jdbc.DatabaseMetaDataUsingInfoSchema.getSQLKeywords(DatabaseMetaDataUsingInfoSchema.java:1193)
at com.zaxxer.hikari.pool.HikariProxyDatabaseMetaData.getSQLKeywords(HikariProxyDatabaseMetaData.java)
at org.hibernate.engine.jdbc.env.internal.ExtractedDatabaseMetaDataImpl$Builder.apply(ExtractedDatabaseMetaDataImpl.java:202)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentImpl.(JdbcEnvironmentImpl.java:265)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:114)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:176)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1858)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1795)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236)
at com.netintech.NtFoundationApplication.main(NtFoundationApplication.java:21)
16:15:19.783 [main] ERROR o.s.o.j.LocalContainerEntityManagerFactoryBean TID: N/A - [buildNativeEntityManagerFactory,408] - Failed to initialize JPA EntityManagerFactory: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
16:15:19.785 [main] WARN o.s.b.w.s.c.AnnotationConfigServletWebServerApplicationContext TID: N/A - [refresh,559] - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
16:15:19.810 [main] INFO c.z.h.HikariDataSource TID: N/A - [close,350] - HikariPool-1 - Shutdown initiated…
16:15:19.820 [main] INFO c.z.h.HikariDataSource TID: N/A - [close,352] - HikariPool-1 - Shutdown completed.
16:15:19.822 [main] INFO o.a.c.c.StandardService TID: N/A - [log,173] - Stopping service [Tomcat]
16:15:19.839 [main] INFO o.s.b.a.l.ConditionEvaluationReportLoggingListener TID: N/A - [logMessage,136] -

Error starting ApplicationContext. To display the conditions report re-run your application with ‘debug’ enabled.
16:15:19.878 [main] ERROR o.s.b.SpringApplication TID: N/A - [reportFailure,834] - Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘entityManagerFactory’ defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaConfiguration.class]: Invocation of init method failed; nested exception is org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1799)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:516)
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:324)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:234)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1109)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:551)
at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:143)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:755)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:747)
at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:402)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:312)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1247)
at org.springframework.boot.SpringApplication.run(SpringApplication.java:1236)
at com.netintech.NtFoundationApplication.main(NtFoundationApplication.java:21)
Caused by: org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:275)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:237)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.id.factory.internal.DefaultIdentifierGeneratorFactory.injectServices(DefaultIdentifierGeneratorFactory.java:152)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.injectDependencies(AbstractServiceRegistryImpl.java:286)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.initializeService(AbstractServiceRegistryImpl.java:243)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.getService(AbstractServiceRegistryImpl.java:214)
at org.hibernate.boot.internal.InFlightMetadataCollectorImpl.(InFlightMetadataCollectorImpl.java:176)
at org.hibernate.boot.model.process.spi.MetadataBuildingProcess.complete(MetadataBuildingProcess.java:127)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.metadata(EntityManagerFactoryBuilderImpl.java:1224)
at org.hibernate.jpa.boot.internal.EntityManagerFactoryBuilderImpl.build(EntityManagerFactoryBuilderImpl.java:1255)
at org.springframework.orm.jpa.vendor.SpringHibernateJpaPersistenceProvider.createContainerEntityManagerFactory(SpringHibernateJpaPersistenceProvider.java:58)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.createNativeEntityManagerFactory(LocalContainerEntityManagerFactoryBean.java:365)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.buildNativeEntityManagerFactory(AbstractEntityManagerFactoryBean.java:391)
at org.springframework.orm.jpa.AbstractEntityManagerFactoryBean.afterPropertiesSet(AbstractEntityManagerFactoryBean.java:378)
at org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean.afterPropertiesSet(LocalContainerEntityManagerFactoryBean.java:341)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1858)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1795)
… 17 common frames omitted
Caused by: org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null when ‘hibernate.dialect’ not set
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.determineDialect(DialectFactoryImpl.java:100)
at org.hibernate.engine.jdbc.dialect.internal.DialectFactoryImpl.buildDialect(DialectFactoryImpl.java:54)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:137)
at org.hibernate.engine.jdbc.env.internal.JdbcEnvironmentInitiator.initiateService(JdbcEnvironmentInitiator.java:35)
at org.hibernate.boot.registry.internal.StandardServiceRegistryImpl.initiateService(StandardServiceRegistryImpl.java:101)
at org.hibernate.service.internal.AbstractServiceRegistryImpl.createService(AbstractServiceRegistryImpl.java:263)
… 34 common frames omitted
16:15:20.821 [Thread-4] WARN c.a.n.c.h.HttpClientBeanHolder TID: N/A - [shutdown,102] - [HttpClientBeanHolder] Start destroying common HttpClient
16:15:20.821 [Thread-12] WARN c.a.n.c.n.NotifyCenter TID: N/A - [shutdown,136] - [NotifyCenter] Start destroying Publisher
16:15:20.821 [Thread-12] WARN c.a.n.c.n.NotifyCenter TID: N/A - [shutdown,153] - [NotifyCenter] Destruction of the end
16:15:20.822 [Thread-4] WARN c.a.n.c.h.HttpClientBeanHolder TID: N/A - [shutdown,111] - [HttpClientBeanHolder] Destruction of the end
Disconnected from the target VM, address: ‘127.0.0.1:45144’, transport: ‘socket’

我检查了tidb的系统库,INFORMATION_SCHEMA下,确实没有发现名为KEYWORDS的表,但是同样的库表在mysql8.0的版本是存在的。似乎我的spring boot启动自动装配会使用到这个表,导致我的程序无法正常启动,有什么办法可以解决这个问题。

目前确实没有KEYWORDS表,使用的是 mysql jdbc 8么?换成 5.7 试试?


建议更新下 hibernate 版本再试

这张表在tidb后面的版本会加上,参加pr
https://github.com/pingcap/tidb/pull/48807

1 个赞

为啥非要要求有这个表,是在不行建一个不就过去了 :joy_cat:

jdbc的版本问题把,还有排除下大小写问题

我尝试将

   <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>8.0.32</version>
    </dependency>

的驱动替换为

    <dependency>
        <groupId>mysql</groupId>
        <artifactId>mysql-connector-java</artifactId>
        <version>5.1.47</version>
    </dependency>

程序恢复了正常。我在mysql5.7的数据库中也是没有找到KEYWORDS表的。这应当是mysql8驱动的问题,然而8.0的驱动可以适配5.7的mysql,但是似乎没办法适配到tidb

1 个赞

可以用 tidb 的专属驱动

https://docs.pingcap.com/zh/tidb/stable/dev-guide-choose-driver-or-orm

2 个赞

你这明显是代码问题。找找原因

很明显,这是你的程序连接TiDB时的jdbc驱动版本问题。

对接 TiDB 开发程序应用时,建议用 tidb 官方推荐的专属驱动tidb-driver-orm

对,这个表是 MySQL 8.0.13 加进去的,用 5。1 也不是不行。
hibernate 新版本有适配tidb,升级试试看。

Hibernate还有一些其他注意事项,请参考

https://docs.pingcap.com/zh/tidb/dev/dev-guide-choose-driver-or-orm#java-orm-框架

这种现象往往是SQL语句中使用了不支持的函数导致的,我们在迁移中遇到过。

当时如何处理解决的呢?屏蔽了相关语句?

首先找功能相同或者类似的函数替换,如果没有,就直接改写SQL

在tidb最新版本的驱动里,getSQLKeywords方法,还是会去做keywords的查询
ResultSet rs = stmt.executeQuery(“SELECT WORD FROM INFORMATION_SCHEMA.KEYWORDS WHERE RESERVED=1 ORDER BY WORD”);
建议修改驱动源码

这里的驱动说的是 mysql-connector?

这个问题有两个临时方案,
一是用5.1jdbc,就不会去找keyword表,
二是改tidb版本号,前缀改成5.7

三,tidb最新版本加入了keyword表,等8.1 LTS发版后,可以升级。

1 个赞

此话题已在最后回复的 60 天后被自动关闭。不再允许新回复。