mysql踩过的坑
报错关于tx_read_only的
因为mysql数据库与驱动包版本不一样,mysql数据库用的8以上的,驱动用的版本是5点多的,mysql8移除了这个属性,要在链接的URL上加&useLocalSessionState=true这个就ok了
报错关于query_cache_size的
也是因为mysql和驱动的版本问题,mysql8数据库移除了这个属性,将mysql的驱动包版本升级到8.0.11 或 8.0.16 就没有问题了
报错关于Could not create connection to database server. Attempted reconnect 3 times. Giving up.的
是因为时间的问题,在数据库驱动6.0以上必须在链接数据库的url上加&serverTimezone=UTC这个参数
UTC代表的是全球标准时间
使用北京时间可以使用Asia/Shanghai
如果你用的springboot通用mapper,报错找不到mapper的话
比如:Field stuMapper in com.imooc.service.impl.StuServiceImpl required a bean of type ‘com.imooc.mapper.StuMapper’ that could not be found.
要在启动类里加@MapperScan(basePackages = “com.imooc.mapper”)。注意是用的tk包下的这个注解