Mysql8使用问题汇总

一、编码问题

https://www.cnblogs.com/minutes/p/10808026.html

SHOW VARIABLES WHERE Variable_name LIKE 'collation%';

ALTER TABLE table-name CHARACTER SET charset-name COLLATE collation-name;

ALTER TABLE `up_account_info` DEFAULT CHARACTER SET utf8 COLLATE=utf8_general_ci;
ALTER TABLE up_account_info CONVERT TO CHARACTER SET utf8 COLLATE utf8_general_ci;

修改字符集

二、MySQL在高版本需要指明是否进行SSL连接

在mysql连接字符串url中加入ssl=true或者false即可,如下所示。
url=jdbc:mysql://127.0.0.1:3306/test?characterEncoding=utf8&useSSL=false

三、mysql-connector-java版本升级到5.1.49解决时间字段存库问题

Caused by: java.lang.NullPointerException
    at com.mysql.jdbc.PreparedStatement.setTimestamp(PreparedStatement.java:4241)
    at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setTimestamp(FilterChainImpl.java:3393)
    at com.alibaba.druid.filter.FilterAdapter.preparedStatement_setTimestamp(FilterAdapter.java:1381)
    at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_setTimestamp(FilterChainImpl.java:3390)
    at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.setTimestamp(PreparedStatementProxyImpl.java:632)
    at com.alibaba.druid.pool.DruidPooledPreparedStatement.setTimestamp(DruidPooledPreparedStatement.java:413)

Mysql8使用问题汇总_第1张图片

四、druid升级到最新版本1.1.20+

你可能感兴趣的:(框架搭建问题汇总,mysql,jdbc,java,timestamp)