欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  网络运营

linux 后台日志 mysql 错误异常的解释(推荐)

程序员文章站 2022-06-19 19:01:46
1、caused by: com.mysql.jdbc.exceptions.jdbc4.communicationsexception: the last packe...

1、caused by: com.mysql.jdbc.exceptions.jdbc4.communicationsexception:

the last packet successfully received from the server was 56,201,339 milliseconds ago.  the last packet sent successfully to the server was 56,201,339 milliseconds ago. is longer than the server configured value of 'wait_timeout'. you should consider either expiring and/or testing connection validity before use in your application, increasing the server configured values for client timeouts, or using the connector/j connection property 'autoreconnect=true' to avoid this problem.

at sun.reflect.generatedconstructoraccessor257.newinstance(unknown source)
at sun.reflect.delegatingconstructoraccessorimpl.newinstance(delegatingconstructoraccessorimpl.java:45)
at java.lang.reflect.constructor.newinstance(constructor.java:534)
at com.mysql.jdbc.util.handlenewinstance(util.java:406)
at com.mysql.jdbc.sqlerror.createcommunicationsexception(sqlerror.java:1074)
at com.mysql.jdbc.mysqlio.send(mysqlio.java:3291)
at com.mysql.jdbc.mysqlio.sendcommand(mysqlio.java:1938)
at com.mysql.jdbc.mysqlio.sqlquerydirect(mysqlio.java:2107)
at com.mysql.jdbc.connectionimpl.execsql(connectionimpl.java:2648)
at com.mysql.jdbc.preparedstatement.executeinternal(preparedstatement.java:2086)
at com.mysql.jdbc.preparedstatement.executequery(preparedstatement.java:2237)
at org.hibernate.jdbc.abstractbatcher.getresultset(abstractbatcher.java:186)
at org.hibernate.loader.loader.getresultset(loader.java:1787)
at org.hibernate.loader.loader.doquery(loader.java:674)
at org.hibernate.loader.loader.doqueryandinitializenonlazycollections(loader.java:236)
at org.hibernate.loader.loader.dolist(loader.java:2213)
... 45 more

解释:

最后从服务器接收到数据包成功是56201339毫秒。最后一个数据包发送成功服务器56201339毫秒。长于服务器配置“wait_timeout”的价值。你应该考虑到期和/或有效性测试连接在应用程序中使用之前,增加服务器为客户机超时配置值,或使用连接器/ j连接属性“autoreconnect = true”来避免这个问题。

linux 下/etc/mysql/mysql.cnf

mysql.cnf文件

#
# the mysql database server configuration file.
#
# you can copy this to one of:
# - "/etc/mysql/my.cnf" to set global options,
# - "~/.my.cnf" to set user-specific options.
#
# one can use all long options that the program supports.
# run program with --help to get a list of available options and with
# --print-defaults to see which it would actually understand and use.
#
# for explanations see
# http://dev.mysql.com/doc/mysql/en/server-system-variables.html


# this will be passed to all mysql clients
# it has been reported that passwords should be enclosed with ticks/quotes
# escpecially if they contain "#" chars...
# remember to edit /etc/mysql/debian.cnf when changing the socket location.
[client]
port = 3306
socket = /var/run/mysqld/mysqld.sock


# here is entries for some specific programs
# the following values assume you have at least 32m ram


# this was formally known as [safe_mysqld]. both versions are currently parsed.
[mysqld_safe]
socket = /var/run/mysqld/mysqld.sock
nice = 0


[mysqld]
wait_timeout=86400000
interactive_timeout=86400000

#
# * basic settings
#
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
lc-messages-dir = /usr/share/mysql
skip-external-locking
#
# instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
#bind-address = 127.0.0.1
bind-address = 0.0.0.0
#
# * fine tuning
#
key_buffer = 16m
max_allowed_packet = 16m
thread_stack = 192k
thread_cache_size       = 8
# this replaces the startup script and checks myisam tables if needed
# the first time they are touched
myisam-recover         = backup
#max_connections        = 100
max_connections        = 10000
#table_cache            = 64
#thread_concurrency     = 10
#
# * query cache configuration
#
query_cache_limit = 1m
query_cache_size        = 16m
#
# * logging and replication
#
# both location gets rotated by the cronjob.
# be aware that this log type is a performance killer.
# as of 5.1 you can enable the log at runtime!
#general_log_file        = /var/log/mysql/mysql.log
#general_log             = 1
#
# error log - should be very few entries.
#
log_error = /var/log/mysql/error.log
#
# here you can see queries with especially long duration
#log_slow_queries = /var/log/mysql/mysql-slow.log
#long_query_time = 2
#log-queries-not-using-indexes
#
# the following can be used as easy to replay backup logs or for replication.
# note: if you are setting up a replication slave, see readme.debian about
#       other settings you may need to change.
#server-id = 1
log_bin = /var/log/mysql/mysql-bin.log
expire_logs_days = 14
max_binlog_size         = 100m
#binlog_do_db = include_database_name
#binlog_ignore_db = include_database_name
#
# * innodb
#
# innodb is enabled by default with a 10mb datafile in /var/lib/mysql/.
# read the manual for more innodb related options. there are many!
#
# * security features
#
# read the manual, too, if you want chroot!
# chroot = /var/lib/mysql/
#
# for generating ssl certificates i recommend the openssl gui "tinyca".
#
# ssl-ca=/etc/mysql/cacert.pem
# ssl-cert=/etc/mysql/server-cert.pem
# ssl-key=/etc/mysql/server-key.pem

[mysqldump]
quick
quote-names
max_allowed_packet = 16m


[mysql]
#no-auto-rehash # faster start of mysql but no tab completition


[isamchk]
key_buffer = 16m


#
# * important: additional settings that can override those from this file!
#   the files must end with '.cnf', otherwise they'll be ignored.
#
!includedir /etc/mysql/conf.d/


lower_case_table_names = 1

以上就是小编为大家带来的linux 后台日志 mysql 错误异常的解释(推荐)全部内容了,希望大家多多支持~