具体方法:
(推荐教程:mysql数据库学习教程)
查看当前连接数
./mysql -uroot -p1234.com -e 'show status' | grep -i Threads Delayed_insert_threads 0 Slow_launch_threads 0 Threads_cached 1 Threads_connected 1 Threads_created 2 Threads_running 1 ##(当前连接数)
mysql> show status like 'Threads%'; +-------------------+-------+ | Variable_name | Value | +-------------------+-------+ | Threads_cached | 1 | | Threads_connected | 1 | | Threads_created | 2 | | Threads_running | 1 | ###当前连接数 +-------------------+-------+ 4 rows in set (0.00 sec)
查看连接数
[root@xxx bin]# ./mysql -uroot -p1234.com -e 'show variables' | grep max_connections max_connections 500
mysql> show global variables like 'max_conn%'; +--------------------+-------+ | Variable_name | Value | +--------------------+-------+ | max_connect_errors | 10 | | max_connections | 500 |## 连接数 +--------------------+-------+ 2 rows in set (0.00 sec)