Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Database operation and maintenance platform

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Inception_web installation of database operation and maintenance platform

Preface

Inception is an automated database operation and maintenance system that integrates auditing SQL, executing SQL and rolling back.

Environment:

System: centos 6.8

Ip: 192.168.137.38

Python:Python2.7

Deployment steps:

# cd / usr/src/

# wget https://github.com/mysql-inception/inception/archive/master.zip

# unzip master.zip

# yum-y install gcc gcc-c++ cmake bison openssl-devel ncurses-devel mysql-devel

# cd inception-master

#. / inception_build.sh debug [Xcode] # [Xcode] specify the default linux for the platform

# echo $? # if 0 is returned, it is successful.

# Edit the configuration file, and if not, create it

# vim / etc/inc.cnf

[inception]

General_log=1

General_log_file=inc.log

Port=6669

Socket=/tmp/inc.socket

Character-set-client-handshake=0

Character-set-server=utf8

Inception_remote_system_password=admin

Inception_remote_system_user=myadmin

Inception_remote_backup_port=3308

Inception_remote_backup_host=127.0.0.1

Inception_support_charset=utf8

Inception_enable_nullable=0

Inception_check_primary_key=1

Inception_check_column_comment=1

Inception_check_table_comment=1

Inception_osc_min_table_size=1

Inception_osc_bin_dir=/usr/bin

Inception_osc_chunk_time=0.1

Inception_ddl_support=1

Inception_enable_blob_type=1

Inception_check_column_default_value=1

# press esc first, then press shift followed by: enter wq! Save exit

# the following should be run according to the directory of the unzipped package files and load the files

# / usr/src/inception-master/debug/mysql/bin/Inception-- defaults-file=/etc/inc.cnf &

# Log in to mysql

# mysql-uroot-h227.0.0.1-P 6669

# enter the following command in mysql

# inception get variables

# upgrade Python to 2.7

# cd / usr/src/

# wget http://www.python.org/ftp/python/2.7.3/Python-2.7.3.tgz

# tar-xf Python-2.7.3.tgz

# cd Python-2.7.3

#. / configure-prefix=/usr/local/python27

# echo $?

# make & & make install

# echo $?

# mv / usr/bin/python / usr/bin/python26

# ln-s / usr/local/python27/bin/python2.7 / usr/bin/python

# vim / usr/bin/yum

# change #! / usr/bin/python to #! / usr/bin/python26

# enter Python to see if it is 2.7.Then exit () exits, and type yum list to see if the yum source is normal

# cd / usr/src/

# wget https://bootstrap.pypa.io/ez_setup.py-- no-check-certificate

# python ez_setup.py

# [root@localhost ~] # find /-name easy_install-2.7

/ usr/local/python27/bin/easy_install-2.7

# cd / usr/local/python27/bin/

#. / easy_install-2.7 pip

# echo $?

# [root@localhost bin] # find /-name pip2.7

/ usr/local/python27/bin/pip2.7

#. / pip2.7 install flask_wtf

#. / pip2.7 install flask-script

#. / pip2.7 install flask-debugtoolbar

#. / pip2.7 install MySQL-python

# cd / usr/src/

# yum install git

# git clone https://github.com/dbalihui/inception_web.git

# cd inception_web/app/

# vim inception.py # (Note: the red part is defined for yourself)

Coding=utf-8

Import MySQLdb

Def table_structure (mysql_structure):

Sql1='/*--user=root;--password=root;--host=127.0.0.1;--execute=1;--port=3306;*/\

Inception_magic_start;\

Use test_3;'

Sql2='inception_magic_commit;'

Sql = sql1 + mysql_structure + sql2

Try:

Conn=MySQLdb.connect (host='127.0.0.1',user='root',passwd='root',db='test_3',port=6669,use_unicode=True, charset= "utf8")

Cur=conn.cursor ()

Ret=cur.execute (sql)

Result=cur.fetchall ()

Num_fields = len (cur.description)

Field_names = [I [0] for i in cur.description]

Print field_names

For row in result:

Print row [0], "|", row [1], "|", row [2], "|", row [3], "|", row [4], "|", row [5], "|", row [6], "|, row [7]," | ", row [8]," | ", row [9]," | ", row [10]

Cur.close ()

Conn.close ()

Except MySQLdb.Error,e:

Print "Mysql Error% d:% s"% (e.args [0], e.args [1])

Return result [1] [4] .split ("\ n")

# cd.. # return to the previous level

#. / run.py runserver-- host 192.168.137.38 & # your own server ip

Browser input: ip:5000 for example: 192.168.137.38 purl 5000

# vim / etc/sysconfig/iptables # Open Port 3306P5000

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 3306-j ACCEPT

-An INPUT-m state-- state NEW-m tcp-p tcp-- dport 5000-j ACCEPT

# service iptables restart

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report