• mysql自身报错、java、reids连接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

    [root@host-10-1-1-193 logs]# cd /usr/local/tomcat/tomcat-jenkins/logs

    [root@host-10-1-1-193 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


    [root@host-10-1-1-193 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 就可以,不要使用变量

  • 相关阅读:
    php 解析xml
    php
    php 设置自动加载某个页面
    Mac
    mysql
    Git
    C#
    C# 正则表达式
    C# ASCII码排序
    (转)datagridview 自定义列三步走
  • 原文地址:https://www.cnblogs.com/effortsing/p/10011393.html
Copyright © 2020-2023  润新知