一聚教程网:一个值得你收藏的教程网站

热门教程

使用JDBC连接Mysql 8.0.11出现了各种错误的解决方法

时间:2022-06-29 09:06:58 编辑:袖梨 来源:一聚教程网

本想着自己安装数据库还是很熟悉了   没想到这次彻底被征服了

虽然以前装的都是Mysql 5.7 ,这次第一次安装Mysql 8.0.11,安装起来不费事,感觉还得心应手,但是   但是 就在用JDBC连接数据库和用jdbc.properties文件时出现了巨多的错误 ,一环扣一环,解决了一个 又生成一个

总结一下都有这些问题:(前提是在cmd下和可视化界面下正常使用)
1.检测连接引擎和数据库版本是否匹配

2.看了很多是要改密码  有两个属性很奇葩  some_user和user_host 一直很懵逼是什么字段  最后知道了  死活提示没有password字段   然后有查到说是Mysql从5.7开始就没有password字段   改为了authentication_string字段

然后才修改了字段  

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'root';

3.不知道怎么滴一顿操作 cmd和Navicat也进不去了  估计是my.ini的配置文件乱了

出现了#1045 Access denied for user 'root'@'localhost' (using password:YES)”问题

"mysqld-nt --skip-grant-tables

说是这个命令可以跳过密码验证,试了没什么用  怎么都要输入密码  很尴尬,最后也因为cmd也进不去  下狠心  不改了直接卸载了Mysql  重新装了一个。

4.使用JDBC连接MySql时出现:The server time zone value '�й���׼ʱ��' is unrecognized or represents more than one time zone. You must configure either the server or JDBC driver (via the serverTimezone configuration

把URl改为这个样子就好了

jdbc:mysql://127.0.0.1:3306/test?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC
5.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.

这个简单  加上  就行了

useSSL=false

6.真是一个接一个   又来了Unknown system variable 'query_cache_size'

这个也很容易   下载一个mysql-connector-java-8.0.11.jar就可以了

以上就是本文的全部内容,希望对大

热门栏目