Get the App
SLTechnology News&Howtos  ›  Database  › 

MySQL one-click optimization script how to write

Shulou Source: shulou.com Published: 2022-05-31 13:13:13 10月03日 Update

MySQL one-click optimization script how to write, in view of this problem, this article describes in detail the corresponding analysis and solutions, hoping to help more partners who want to solve this problem to find a more simple and easy way.

Overview

Today, we will mainly share the next rewritten mysql one-click optimization script.

Environmental preparation

Module-MySQLDB

Module-sqlparse

Python version = 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. Script

# 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. Execution result

Execute the command as follows:

# 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. Output content

You can see that the results after execution are as follows:

This is the answer to the question about how to write the optimization script with one click of MySQL. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Scripts one-click questions content more modules results help answers easy easy commands guys partners methods versions environment knowledge articles industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno macOS Apple MariaDB MySQL Microsoft