长连接配置

1、PHP

持久化连接

<?php
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass, array(
    PDO::ATTR_PERSISTENT => true
));
?>

2、mysql

默认长连接

mysql > show global  variables like 'wait_timeout'

配置文件(my.cnf) wait_timeout
=28800 interactive_timeout=28800

 

 

 

 

posted on 2019-11-19 10:40  五光十色  阅读(220)  评论(0编辑  收藏  举报

导航