码迷,mamicode.com
首页 > 数据库 > 详细

Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep linux下mysql修改连接超时wait_timeout修改后就ok了

时间:2018-11-24 14:08:28      阅读:289      评论:0      收藏:0      [点我收藏+]

标签:wait   slave   org   set   lin   linu   ESS   off   for   

Linuxmysql修改连接超时wait_timeout

 

1,首先:

show variables like ‘%timeout%‘

 

显示结果:

 

+-----------------------------+----------+

| Variable_name               | Value    |

+-----------------------------+----------+

| connect_timeout             | 10       |

| delayed_insert_timeout      | 300      |

| innodb_flush_log_at_timeout | 1        |

| innodb_lock_wait_timeout    | 50       |

| innodb_rollback_on_timeout  | OFF      |

| interactive_timeout         | 28800    |

| lock_wait_timeout           | 31536000 |

| net_read_timeout            | 30       |

| net_write_timeout           | 60       |

| rpl_stop_slave_timeout      | 31536000 |

| slave_net_timeout           | 3600     |

| wait_timeout                | 28800    |

+-----------------------------+----------+

12 rows in set (0.00 sec)

 

其中有用的是: interactive_timeout  wait_timeout  28800,默认为8小时设置;

 

一般线上的环境中mysql中连接时间设置为7天即可;

 

2,其次:

执行命令:       set  interactive_timeout=604800

 

                  set  wait_timeout=604800

 

最后:执行?show variables like ‘%timeout%‘;看看执行成功没有,显示结果为:

 

?

+-----------------------------+----------+

| Variable_name               | Value    |

+-----------------------------+----------+

| connect_timeout             | 10       |

| delayed_insert_timeout      | 300      |

| innodb_flush_log_at_timeout | 1        |

| innodb_lock_wait_timeout    | 50       |

| innodb_rollback_on_timeout  | OFF      |

| interactive_timeout         | 604800   |

| lock_wait_timeout           | 31536000 |

| net_read_timeout            | 30       |

| net_write_timeout           | 60       |

| rpl_stop_slave_timeout      | 31536000 |

| slave_net_timeout           | 3600     |

| wait_timeout                | 604800   |

+-----------------------------+----------+

12 rows in set (0.00 sec)

 

表明执行成功了。。。

Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep linux下mysql修改连接超时wait_timeout修改后就ok了

标签:wait   slave   org   set   lin   linu   ESS   off   for   

原文地址:https://www.cnblogs.com/torchstar/p/10011244.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!