php - 从php获取mysql等待超时

标签 php mysql

有没有办法直接从php获取mysql的wait timeout?

最佳答案

只需进行一个普通的 mysql 查询即可。

mysql> show variables where Variable_name='wait_timeout';
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| wait_timeout  | 28800 |
+---------------+-------+
1 row in set (0.07 sec)

在 PHP 中它看起来像这样。

// it's been a while to there might be typos
$res = mysql_query("show variables where Variable_name='wait_timeout'");
$arr = mysql_fetch_assoc($res);
echo $arr['Variable_name'];
echo $arr['Value'];

关于php - 从php获取mysql等待超时,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5740987/

相关文章:

MySQL根据id order by listorder获取上一条和下一条记录

MySQL 自定义排序

PHP 不发送表单到 MySQL 数据库

php - 选择特定的重复数据库值并显示计数

php - 标记未显示在 map 上

MySQL:查找日期范围之间的缺失日期

MySQL Order by Rand() 在结果顶部

SQL SELECT 与 m :n relationship

php - 带有内连接的 json 数组

php - 在 php 中使用正则表达式时出现奇怪的事情