spring+mysql8:Could not retrieve transation read-only status server

数据库使用mysql8.x运行spring时报错,主要是mysql版本问题,解决方案:

.1.之前的连接url配置

jdbc:mysql://localhost:3306/sampledb修改为

jdbc:mysql://localhost:3306/sampledb?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=UTC"

2..mysql8.0对jdbc驱动版本有要求,使用

<dependency>

    <groupId>mysql</groupId>

    <artifactId>mysql-connector-java</artifactId>

    <version>8.0.11</version>

    <scope>runtime</scope>

</dependency>

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容