Skip to content

session_ssl_status

xiaoboluo768 edited this page Jun 9, 2020 · 2 revisions
  • 查看SSL链接状态信息(显示重用SSL会话的SSL版本,密码和计数),数据来源:status_by_thread

    • 此视图在MySQL 5.7.9中新增
  • session_ssl_status视图字段含义如下:

    • thread_id:连接的线程ID
    • SSL_VERSION:连接使用的SSL版本
    • ssl_cipher:连接使用的SSL密码,如果客户端使用了ssl连接,则该连接查询到的会话级别该状态变量有类似 'DHE-RSA-AES128-GCM-SHA256' 的字符串值
    • ssl_sessions_reused:连接重用的SSL会话数(ssl连接可以缓存并给其他支持ssl连接的客户端重用)
  • 视图定义语句

CREATE OR REPLACE
  ALGORITHM = MERGE
  DEFINER = 'root'@'localhost'
  SQL SECURITY INVOKER
VIEW session_ssl_status (
  thread_id,  ssl_version,  ssl_cipher,  ssl_sessions_reused
) AS
SELECT sslver.thread_id,
      sslver.variable_value ssl_version,
      sslcip.variable_value ssl_cipher,
      sslreuse.variable_value ssl_sessions_reused
  FROM performance_schema.status_by_thread sslver
  LEFT JOIN performance_schema.status_by_thread sslcip
    ON (sslcip.thread_id=sslver.thread_id and sslcip.variable_name='Ssl_cipher')
  LEFT JOIN performance_schema.status_by_thread sslreuse
    ON (sslreuse.thread_id=sslver.thread_id and sslreuse.variable_name='Ssl_sessions_reused')
WHERE sslver.variable_name='Ssl_version';
  • 视图查询信息示例
admin@localhost : sys 12:45:27> select * from session_ssl_status;
+-----------+-------------+------------+---------------------+
| thread_id | ssl_version | ssl_cipher | ssl_sessions_reused |
+-----------+-------------+------------+---------------------+
|        45 |            |            | 0                  |
|        46 |            |            | 0                  |
|        47 |            |            | 0                  |
|        48 |            |            | 0                  |
|        49 |            |            | 0                  |
+-----------+-------------+------------+---------------------+
5 rows in set (0.00 sec)

上一篇: session,x$session视图 |

下一篇: statement_analysis,x$statement_analysis视图

Clone this wiki locally