日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

linux下查看mysql的当前连接情况

發(fā)布時(shí)間:2023/12/9 数据库 37 豆豆
生活随笔 收集整理的這篇文章主要介紹了 linux下查看mysql的当前连接情况 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

為什么80%的碼農(nóng)都做不了架構(gòu)師?>>> ??

首先需要登錄到mysql中。

總共有三個(gè)命令:

1、status

mysql>?status--------------mysql??Ver?14.14?Distrib?5.5.30,?for?Linux?(x86_64)?using?readline?5.1Connection?id:??????????96Current?database: Current?user:???????????root@localhost SSL:????????????????????Not?in?use Current?pager:??????????stdout Using?outfile:??????????''Using?delimiter:????????;Server?version:?????????5.5.30?MySQL?Community?Server?(GPL) Protocol?version:???????10Connection:?????????????Localhost?via?UNIX?socket Server?characterset:????latin1 Db?????characterset:????latin1 Client?characterset:????utf8 Conn.??characterset:????utf8 UNIX?socket:????????????/var/lib/mysql/mysql.sock Uptime:?????????????????7?hours?58?min?1?secThreads:?11??Questions:?16093??Slow?queries:?0??Opens:?70??Flush?tables:?1??Open?tables:?41??Queries?per?second?avg:?0.561--------------


2、show processlist(查看當(dāng)前用戶的連接,root用戶查看所有的)

mysql>?show?processlist; +----+------+-----------------+-------+---------+------+-------+------------------+ |?Id?|?User?|?Host????????????|?db????|?Command?|?Time?|?State?|?Info?????????????| +----+------+-----------------+-------+---------+------+-------+------------------+ |??1?|?root?|?localhost:40214?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??2?|?root?|?localhost:40215?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??3?|?root?|?localhost:40216?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??4?|?root?|?localhost:40217?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??5?|?root?|?localhost:40218?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??6?|?root?|?localhost:40219?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??7?|?root?|?localhost:40220?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??8?|?root?|?localhost:40221?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |??9?|?root?|?localhost:40222?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |?10?|?root?|?localhost:40223?|?b3log?|?Sleep???|???18?|???????|?NULL?????????????| |?97?|?root?|?localhost???????|?NULL??|?Query???|????0?|?NULL??|?show?processlist?| +----+------+-----------------+-------+---------+------+-------+------------------+11?rows?in?set?(0.00?sec)

3、show status

|?Qcache_queries_in_cache??????????????????|?0???????????| |?Qcache_total_blocks??????????????????????|?0???????????| |?Queries??????????????????????????????????|?16137???????| |?Questions????????????????????????????????|?2???????????| |?Rpl_status???????????????????????????????|?AUTH_MASTER?| |?Select_full_join?????????????????????????|?0???????????| |?Select_full_range_join???????????????????|?0???????????| |?Select_range?????????????????????????????|?0???????????| |?Select_range_check???????????????????????|?0???????????| |?Select_scan??????????????????????????????|?0???????????| |?Slave_heartbeat_period???????????????????|?0.000???????| |?Slave_open_temp_tables???????????????????|?0???????????| |?Slave_received_heartbeats????????????????|?0???????????| |?Slave_retried_transactions???????????????|?0???????????| |?Slave_running????????????????????????????|?OFF?????????| |?Slow_launch_threads??????????????????????|?0???????????| |?Slow_queries?????????????????????????????|?0???????????| |?Sort_merge_passes????????????????????????|?0???????????| |?Sort_range???????????????????????????????|?0???????????| |?Sort_rows????????????????????????????????|?0???????????| |?Sort_scan????????????????????????????????|?0???????????| |?Ssl_accept_renegotiates??????????????????|?0???????????| |?Ssl_accepts??????????????????????????????|?0???????????| |?Ssl_callback_cache_hits??????????????????|?0???????????| |?Ssl_cipher???????????????????????????????|?????????????| |?Ssl_cipher_list??????????????????????????|?????????????| |?Ssl_client_connects??????????????????????|?0???????????| |?Ssl_connect_renegotiates?????????????????|?0???????????| |?Ssl_ctx_verify_depth?????????????????????|?0???????????| |?Ssl_ctx_verify_mode??????????????????????|?0???????????| |?Ssl_default_timeout??????????????????????|?0???????????| |?Ssl_finished_accepts?????????????????????|?0???????????| |?Ssl_finished_connects????????????????????|?0???????????| |?Ssl_session_cache_hits???????????????????|?0???????????| |?Ssl_session_cache_misses?????????????????|?0???????????| |?Ssl_session_cache_mode???????????????????|?NONE????????| |?Ssl_session_cache_overflows??????????????|?0???????????| |?Ssl_session_cache_size???????????????????|?0???????????| |?Ssl_session_cache_timeouts???????????????|?0???????????| |?Ssl_sessions_reused??????????????????????|?0???????????| |?Ssl_used_session_cache_entries???????????|?0???????????| |?Ssl_verify_depth?????????????????????????|?0???????????| |?Ssl_verify_mode??????????????????????????|?0???????????| |?Ssl_version??????????????????????????????|?????????????| |?Table_locks_immediate????????????????????|?2135????????| |?Table_locks_waited???????????????????????|?0???????????| |?Tc_log_max_pages_used????????????????????|?0???????????| |?Tc_log_page_size?????????????????????????|?0???????????| |?Tc_log_page_waits????????????????????????|?0???????????| |?Threads_cached???????????????????????????|?0???????????| |?Threads_connected??(連接數(shù))???????????????|?11??????????| |?Threads_created??????????????????????????|?98??????????| |?Threads_running??????????????????????????|?1???????????| |?Uptime???????????????????????????????????|?28851???????| |?Uptime_since_flush_status????????????????|?28851???????| +------------------------------------------+-------------+312?rows?in?set?(0.00?sec)

如果不能看到全部 ,按ctrl + pageup或pagedown,進(jìn)行上下翻頁

Aborted_clients 由于客戶沒有正確關(guān)閉連接已經(jīng)死掉,已經(jīng)放棄的連接數(shù)量。

Aborted_connects 嘗試已經(jīng)失敗的MySQL服務(wù)器的連接的次數(shù)。

Connections 試圖連接MySQL服務(wù)器的次數(shù)。

Created_tmp_tables 當(dāng)執(zhí)行語句時(shí),已經(jīng)被創(chuàng)造了的隱含臨時(shí)表的數(shù)量。

Delayed_insert_threads 正在使用的延遲插入處理器線程的數(shù)量。

Delayed_writes 用INSERT DELAYED寫入的行數(shù)。

Delayed_errors 用INSERT DELAYED寫入的發(fā)生某些錯(cuò)誤(可能重復(fù)鍵值)的行數(shù)。

Flush_commands 執(zhí)行FLUSH命令的次數(shù)。

Handler_delete 請(qǐng)求從一張表中刪除行的次數(shù)。

Handler_read_first 請(qǐng)求讀入表中第一行的次數(shù)。

Handler_read_key 請(qǐng)求數(shù)字基于鍵讀行。

Handler_read_next 請(qǐng)求讀入基于一個(gè)鍵的一行的次數(shù)。

Handler_read_rnd 請(qǐng)求讀入基于一個(gè)固定位置的一行的次數(shù)。

Handler_update 請(qǐng)求更新表中一行的次數(shù)。

Handler_write 請(qǐng)求向表中插入一行的次數(shù)。

Key_blocks_used 用于關(guān)鍵字緩存的塊的數(shù)量。

Key_read_requests 請(qǐng)求從緩存讀入一個(gè)鍵值的次數(shù)。

Key_reads 從磁盤物理讀入一個(gè)鍵值的次數(shù)。

Key_write_requests 請(qǐng)求將一個(gè)關(guān)鍵字塊寫入緩存次數(shù)。

Key_writes 將一個(gè)鍵值塊物理寫入磁盤的次數(shù)。

Max_used_connections 同時(shí)使用的連接的最大數(shù)目。

Not_flushed_key_blocks 在鍵緩存中已經(jīng)改變但是還沒被清空到磁盤上的鍵塊。

Not_flushed_delayed_rows 在INSERT DELAY隊(duì)列中等待寫入的行的數(shù)量。

Open_tables 打開表的數(shù)量。

Open_files 打開文件的數(shù)量。

Open_streams 打開流的數(shù)量(主要用于日志記載)

Opened_tables 已經(jīng)打開的表的數(shù)量。

Questions 發(fā)往服務(wù)器的查詢的數(shù)量。

Slow_queries 要花超過long_query_time時(shí)間的查詢數(shù)量。

Threads_connected 當(dāng)前打開的連接的數(shù)量。

Threads_running 不在睡眠的線程數(shù)量。

Uptime 服務(wù)器工作了多少秒。


轉(zhuǎn)載于:https://my.oschina.net/daquan/blog/480866

總結(jié)

以上是生活随笔為你收集整理的linux下查看mysql的当前连接情况的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。