Springboot jpa 连接 MySQL 遇到的问题

2018-11-12  本文已影响0人  彩色帆

坑一:

springboot结合spring data jpa出现a bean named 'entityManagerFactory' that could not be found

原文中删除本地仓库\repository\org\hibernate\hibernate-core目录,发现还是存在问题

于是我把hibernate整个删除,重新更新项目,发现问题解决

删除之后,记得 update project 一下

坑二

Establishing SSL connection without server's identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn't set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to 'false'. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification.

解决方案

mysql连接字符串url中加入ssl=true或者false即可,如下所示。

url=jdbc:mysql://127.0.0.1:3306/framework?characterEncoding=utf8&useSSL=false

参考https://blog.csdn.net/guoweimelon/article/details/50810399

补充,一定要是false,否则会报其它的错,真是一坑又一坑啊

com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

坑三

连接MySQL报错Unable to load authentication plugin 'caching_sha2_password'

在网上搜索后发现是由于MySQL在8.0后验证方式由mysql_native_password变为caching_sha2_password,所以连接时会报这个错。

解决方法:

在命令行中进入mysql后运行

alter user root@localhost identified with mysql_native_password by 'password';

参考:https://blog.csdn.net/zeal4rea/article/details/80542658

上一篇 下一篇

猜你喜欢

热点阅读