R&D/database

mysql connection 관련

sunshout 2017. 2. 17. 20:16
mysql> show status where `variable_name` = 'Threads_connected';
+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_connected | 4     |
+-------------------+-------+
1 row in set (0.00 sec)

... or through the show processlist command:

mysql> show processlist;
+----+------+-----------------+--------+---------+------+-------+------------------+
| Id | User | Host            | db     | Command | Time | State | Info             |
+----+------+-----------------+--------+---------+------+-------+------------------+
|  3 | root | localhost       | webapp | Query   |    0 | NULL  | show processlist | 
|  5 | root | localhost:61704 | webapp | Sleep   |  208 |       | NULL             | 
|  6 | root | localhost:61705 | webapp | Sleep   |  208 |       | NULL             | 
|  7 | root | localhost:61706 | webapp | Sleep   |  208 |       | NULL             | 
+----+------+-----------------+--------+---------+------+-------+------------------+
4 rows in set (0.00 sec)

mysql> show variables like '%wait%';

+---------------------------------------------------+----------+

| Variable_name                                     | Value    |

+---------------------------------------------------+----------+

| innodb_lock_wait_timeout                          | 50       |

| innodb_spin_wait_delay                            | 6        |

| lock_wait_timeout                                 | 31536000 |

| ndb_wait_connected                                | 30       |

| ndb_wait_setup                                    | 30       |

| performance_schema_events_waits_history_long_size | 10000    |

| performance_schema_events_waits_history_size      | 10       |

| wait_timeout                                      | 604800   |

+---------------------------------------------------+----------+

8 rows in set (0.00 sec)



SET GLOBAL wait_timeout = 10;