在学习mybatis中,发现连接mysql很多问题在此记录一下:
1.mysql时区的设置:
(1)在db.properties文件中设置:
即
jdbc.url=jdbc:mysql://localhost:3306/mybatis?useUnicode=true&characterEncoding=utf-8&useSSL=false&serverTimezone = GMT
(2)在数据中设置
执行:show variables like “%time_zone%";查看当前mysql数据库时区。
修改时区:set global time_zone="+8:00";
2.报Establishing SSL connection without server's identity verification is not recommended.Establishing SsL connection without server's identity verification is not recommended.问题
在url后面加上 useSSL=false;
有的需要改成true,不行的话都试一下。
3.Resources.getResourceAsStream(resource)找不到该方法?
只需在getResourceAsStream()方法前面添加.class