首批通过分布式安全可靠测评,为关键业务系统打造
MySQL 驱动错误
更新时间:2026-06-03 03:01
本文介绍使用 MySQL V5.1.43 驱动报错的处理方法。
适用版本
OceanBase 数据库所有版本
问题现象
MySQL V5.1.43 驱动提示错误,错误信息如下。
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2020-07-16 22:49:53.585 |-ERROR [main] org.springframework.boot.SpringApplication [771] -|Application startup failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactory' parameter 0; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'entityManagerFactoryBuilder' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Unsatisfied dependency expressed through method 'entityManagerFactoryBuilder' parameter 0; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaVendorAdapter' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.orm.jpa.JpaVendorAdapter]: Factory method 'jpaVendorAdapter' threw exception; nested exception is com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: Unknown system variable 'have_query_cache'
可能原因
MySQL V5.1.43 版本增加了一个 query_cache 的校验功能,实际该功能在 MySQL 中不建议使用,在其他版本的 JDBC 驱动中均不存在该参数检测。
解决方式
替换 MySQL 驱动版本即可解决。