mysql的其他命令

2023-02-18 MYSQL 小于 1 分钟

# 查看连接数

# show processlist; 

mysql> show processlist;
+----+------+-----------------+------+---------+------+-------+------------------+
| Id | User | Host            | db   | Command | Time | State | Info             |
+----+------+-----------------+------+---------+------+-------+------------------+
|  5 | root | localhost:60424 | NULL | Query   |    0 | NULL  | show processlist |
+----+------+-----------------+------+---------+------+-------+------------------+
1 row in set (0.00 sec)

mysql>
1
2
3
4
5
6
7
8
9
10
11

查看最大连接数 ;

# show variables like "max_connections";

mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 100   |
+-----------------+-------+
1 row in set (0.00 sec)

mysql>
1
2
3
4
5
6
7
8
9
10
11

# 修改最大连接数

set GLOBAL max_connections=1000; 
1

mysql在关闭一个非交互的连接之前要等待的秒数,默认是28800s

   show global variables like 'wait_timeout';
1

# 设置wait_timeout

 set global wait_timeout=28800;
 
 set global interactive_timeout=28800;
1
2
3
上次编辑于: 2023年7月4日 09:36