mysql2468报错
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了mysql2468报错相关的知识,希望对你有一定的参考价值。
参考技术A 这是由于数据库和系统时区差异所造成的。在jdbc连接的url后面加上serverTimezone=GMT即可解决问题,如果需要使用gmt+8时区,需要写成GMT%2B8,否则会被解析为空。再一个解决办法就是使用低版本的mysqljdbc驱动,5.1.28不会存在时区的问题。
mysql自身报错javareids连接mysql数据库报错汇总
1、Can‘t connect to local MySQL server through socket ‘tmpmysql.sock‘ (2)
原因是mysql根本没有启动
2、Access denied for user ‘root‘@‘localhost‘ (using password YES)
解决方法:
重置密码就行,重新执行所有授权就行
参考连接:
https://blog.csdn.net/lisongjia123/article/details/57418989
3、com.mysql.jdbc.MysqlDataTruncation Data truncation Incorrect datetime value ‘0000-00-00 000000‘ for column
[[email protected] logs]# cd /usr/local/tomcat/tomcat-jenkins/logs
[[email protected] logs]# ls
catalina.2018-06-26.log catalina.out localhost.2018-06-26.log localhost_access_log.2018-06-26.txt manager.2018-06-26.log
catalina.2018-06-27.log host-manager.2018-06-26.log localhost.2018-06-27.log localhost_access_log.2018-06-27.txt
[[email protected] logs]# tail -f catalina.out
Caused by: com.mysql.jdbc.MysqlDataTruncation: Data truncation: Incorrect datetime value: ‘0000-00-00 00:00:00‘ for column ‘entry_time‘ at row 1
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3833)
at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3771)
at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2435)
at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2582)
at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2535)
at com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1911)
at com.mysql.jdbc.PreparedStatement.execute(PreparedStatement.java:1203)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2931)
at com.alibaba.druid.wall.WallFilter.preparedStatement_execute(WallFilter.java:602)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
at com.alibaba.druid.filter.FilterEventAdapter.preparedStatement_execute(FilterEventAdapter.java:440)
at com.alibaba.druid.filter.FilterChainImpl.preparedStatement_execute(FilterChainImpl.java:2929)
at com.alibaba.druid.proxy.jdbc.PreparedStatementProxyImpl.execute(PreparedStatementProxyImpl.java:131)
at com.alibaba.druid.pool.DruidPooledPreparedStatement.execute(DruidPooledPreparedStatement.java:493)
at org.apache.ibatis.executor.statement.PreparedStatementHandler.update(PreparedStatementHandler.java:45)
at org.apache.ibatis.executor.statement.RoutingStatementHandler.update(RoutingStatementHandler.java:73)
at org.apache.ibatis.executor.ReuseExecutor.doUpdate(ReuseExecutor.java:51)
at org.apache.ibatis.executor.BaseExecutor.update(BaseExecutor.java:115)
at org.apache.ibatis.executor.CachingExecutor.update(CachingExecutor.java:75)
at org.apache.ibatis.session.defaults.DefaultSqlSession.update(DefaultSqlSession.java:170)
at org.apache.ibatis.session.defaults.DefaultSqlSession.insert(DefaultSqlSession.java:157)
at sun.reflect.GeneratedMethodAccessor206.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.mybatis.spring.SqlSessionTemplate$SqlSessionInterceptor.invoke(SqlSessionTemplate.java:386)
分析:
ONLY_FULL_GROUP_BY,STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION
NO_ZERO_IN_DATE,NO_ZERO_DATE是无法默认为‘0000-00-00 00:00:00’的根源,去掉之后再次新建表就可以了
注:
NO_ZERO_IN_DATE:在严格模式下,不允许日期和月份为零
NO_ZERO_DATE:设置该值,mysql数据库不允许插入零日期,插入零日期会抛出错误而不是警告。
测试新建表,ok。可以了。
参考地址:
https://blog.csdn.net/zrp1992/article/details/77868305
4、k8s中java程序中的redis连接容器外部reids总是连接不上导致容器启动失败,查看tomacat日志得知
解决
把java程序的xml 配置文件的reids端口 改成 6379 就可以,不要使用变量
以上是关于mysql2468报错的主要内容,如果未能解决你的问题,请参考以下文章
mysql 启报错报 The server quit without updating PID file
服务器Mysql报错报错#2013 - Lost connection to MySQL server at 'reading initial communication packet