zoukankan      html  css  js  c++  java
  • MySQL常用命令总结

    # 查看最大连接数

    show variables like 'max_connections';
    
    #  临时修改
    set GLOBAL max_connections=200;
    
    # 永久修改
    max_connections=200  # 修改配置文件

    # 查看主从同步状态

    show slave statusG

    #  连接相关状态和变量

    mysql> show status like '%connect%';
    +-----------------------------------------------+---------------------+
    | Variable_name                                 | Value               |
    +-----------------------------------------------+---------------------+
    | Aborted_connects                              | 18                  |
    | Connection_errors_accept                      | 0                   |
    | Connection_errors_internal                    | 0                   |
    | Connection_errors_max_connections             | 3261                |
    | Connection_errors_peer_address                | 0                   |
    | Connection_errors_select                      | 0                   |
    | Connection_errors_tcpwrap                     | 0                   |
    | Connections                                   | 43887383            |
    | Locked_connects                               | 0                   |
    | Max_used_connections                          | 152                 |
    | Max_used_connections_time                     | 2019-07-10 04:01:29 |
    | Performance_schema_session_connect_attrs_lost | 0                   |
    | Ssl_client_connects                           | 0                   |
    | Ssl_connect_renegotiates                      | 0                   |
    | Ssl_finished_connects                         | 0                   |
    | Threads_connected                             | 62                  |
    +-----------------------------------------------+---------------------+
    16 rows in set (0.00 sec)
    
    
    Connection_errors_max_connections:当MySQL的最大并发连接数超过设置的max_connections变量的值,被拒绝的次数会记录到这个状态值里。 这个状态值过高,有可能是系统并发较高,可以考虑调大max_connections。
    
    Connections: MySQL服务从初始化开始成功建立连接的数量,该值不断累加。
    Max_used_connections: MySQL服务从启动开始,同一时刻并发连接的最大值,如果该值很大,则有可能系统并发较高,可以考虑调大max_connections。
    Threads_connected: 当前打开的连接数量。

     # 查看当前执行sql

    select  *  from    information_schema.processlistG
  • 相关阅读:
    进程
    交换分区
    linux命令
    Linux进程
    开会
    今天的学习情况
    CentOS7.6 yum方式安装redis最新版
    Centos7 yum安装postgresql 9.5
    GitLab CI runner can't connect to tcp://localhost:2375 in kubernetes
    Server 2008 R2远程桌面授权,解决120天过期问题
  • 原文地址:https://www.cnblogs.com/root0/p/11244363.html
Copyright © 2011-2022 走看看