python mysql error totally whack
最近在做mysql的監控系統,自己懶得用python寫,就在網上找了一個開發好的python和php的系統搭建了一下,系統名字叫:mysqlmtop,gitbub地址為:https://github.com/yaoshanliang/mysqlmtop
部署在線上環境上,發現mysql的TPS 和QPS一直不顯示,本地的數據庫就顯示,就很奇怪,還在想是不是python代碼的問題,就直接運行了python腳本,結果報錯,
上網查了好久沒查到問題,后來看到一個說是mysql版本的問題,我就看了一下我監控的兩台機子的mysql的版本,果然,一個是5.1,一個是5.7, 如下圖:
- 系統變量
5.7以后System and status 變量需要從performance_schema中進行獲取,information_schema仍然保留了GLOBAL_STATUS,GLOBAL_VARIABLES兩個表做兼容。
[兼容性]
如果希望沿用information_schema中進行查詢的習慣,5.7提供了show_compatibility_56參數,設置為ON可以兼容5.7之前的用法,否則就會報錯,如上圖
5.7.6之后,在performance_schema新增了如下的表:
performance_schema.global_variables
performance_schema.session_variables
performance_schema.variables_by_thread
performance_schema.global_status
performance_schema.session_status
performance_schema.status_by_thread
performance_schema.status_by_account
performance_schema.status_by_host
performance_schema.status_by_user
所以只要在被監控端機器設置如下:
set global show_compatibility_56=on;就好啦,是因為兼容5.7之前的用法
@[TOC](python mysql error totally whack)
# python mysql error totally whack
最近在做mysql的監控系統,自己懶得用python寫,就在網上找了一個開發好的python和php的系統搭建了一下,系統名字叫:mysqlmtop,gitbub地址為:https://github.com/yaoshanliang/mysqlmtop
部署在線上環境上,發現mysql的TPS 和QPS一直不顯示,本地的數據庫就顯示,就很奇怪,還在想是不是python代碼的問題,就直接運行了python腳本,結果報錯,上網查了好久沒查到問題,后來看到一個說是mysql版本的問題,我就看了一下我監控的兩台機子的mysql的版本,果然,一個是5.1,一個是5.7, 如下圖:
## MySQL5.7存在一些新特性及兼容性問題
1. **系統變量** 5.7以后System and status 變量需要從performance_schema中進行獲取,information_schema仍然保留了GLOBAL_STATUS,GLOBAL_VARIABLES兩個表做兼容。 [兼容性]如果希望沿用information_schema中進行查詢的習慣,5.7提供了show_compatibility_56參數,設置為ON可以兼容5.7之前的用法,否則就會報錯,如上圖
5.7.6之后,在performance_schema新增了如下的表:performance_schema.global_variablesperformance_schema.session_variablesperformance_schema.variables_by_threadperformance_schema.global_statusperformance_schema.session_statusperformance_schema.status_by_threadperformance_schema.status_by_accountperformance_schema.status_by_hostperformance_schema.status_by_user
所以只要在被監控端機器設置如下:set global show_compatibility_56=on;就好啦,是因為兼容5.7之前的用法
ps:有興趣的可以關注下我的公眾號和小程序,謝謝啦~~

