前往小程序,Get更优阅读体验!
立即前往
发布
社区首页 >专栏 >Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep

Could not open Hibernate Session for transaction; nested exception is org.hibernate.TransactionExcep

作者头像
samRsa
发布2025-02-24 20:08:59
发布2025-02-24 20:08:59
260
举报
文章被收录于专栏:java知识点总结

Linux下mysql修改连接超时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)

表明执行成功了。。。

本文参与 腾讯云自媒体同步曝光计划,分享自作者个人站点/博客。
原始发表:2018-11-24,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档