分享一份mysql一键优化脚本,值得收藏
环境准备
模块 - MySQLDB
模块 - sqlparse
Python版本 = 2.7.3
yum install -y MySQL-python tar -xvf sqlparse-0.2.3.tar.gz cd sqlparse-0.2.3 python setup.py build python setup.py install
1、脚本

# cat turning_sql.ini [database] server_ip = localhost db_user = turning db_pwd = fsxxx1234 db_name = fsl_prod db_port = 3306 [option] sys_parm = ON sql_plan = ON obj_stat = ON ses_status = ON sql_profile = ON
2、执行结果
执行命令如下:
# python mysql_turn.py -p tunging_sql.ini -s 'select * from t_ocs_production_management pm,t_ocs_production_lines pl where pm.org_code=pl.ascription_org_code'
3、输出内容
可以看到执行后的结果如下:





相关推荐
-
MySQL进阶垫脚石:线程长时间处于killed状态怎么破?
MySQL进阶垫脚石:线程长时间处于killed状态怎么破?2025-04-30 01:10:02 -
「你真的知道吗?」Mysql中的DDL, DML, DCL, 和TCL介绍
「你真的知道吗?」Mysql中的DDL, DML, DCL, 和TCL介绍2025-04-30 00:52:57 -
PHP页面跳转2025-04-30 00:44:40
-
php调用自己的方法报错5002025-04-30 00:16:34
-
MYSQL常用查询Columns和Views2025-04-30 00:14:51