inception安装

  1. documentation
  2. installation
  • compile install bison
cd /usr/local/src
wget http://ftp.gnu.org/gnu/bison/bison-2.5.1.tar.gz
cd bison-2.5.1/
./configure
make && make install
  • compile install inception
cd /usr/local/src
git clone https://github.com/mysql-inception/inception.git
cd inception/
sh inception_build.sh debug     // ignore [Xcode] defualt linux env
  • inc.cnf path & content
/usr/local/src/inception/debug/mysql/bin/inc.cnf 
[inception]
general_log=1
general_log_file=inception.log
port=6669
socket=/自己目录,请自行修改/inc.socket
character-set-client-handshake=0
character-set-server=utf8
inception_remote_system_password=root
inception_remote_system_user=wzf1
inception_remote_backup_port=3306
inception_remote_backup_host=127.0.0.1
inception_support_charset=utf8mb4
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=/data/temp
inception_osc_chunk_time=0.1
inception_enable_blob_type=1
inception_check_column_default_value=1
  • start inception
nohup /usr/local/src/inception/debug/mysql/bin/Inception --defaults-file=inc.cnf &
  • check inception
mysql -uroot -h127.0.0.1 -P6669
inception get variables;        //there are some output if all correct 
  1. python interface exam
apt-get install python-mysqldb      //ubuntu os
  • vim whateveryoulike.py on /wherever/you/like/whateveryoulike.py
vim whateveryoulike.py
#!/usr/bin/python
#-\*-coding: utf-8-\*-
import MySQLdb
sql='/*--user=username;--password=password;--host=127.0.0.1;--execute=1;--port=3306;*/\
inception_magic_start;\
use mysql;\
CREATE TABLE adaptive_office(id int);\
inception_magic_commit;'
try:
    conn=MySQLdb.connect(host='127.0.0.1',user='',passwd='',db='',port=9998)
    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])
  • execute whateveryoulike.py
python  whateveryoulike.py
['ID', 'stage', 'errlevel', 'stagestatus', 'errormessage', 'SQL', 'Affected_rows', 
'sequence', 'backup_dbname', 'execute_time', 'sqlsha1']  
1 | CHECKED | 0 | Audit completed | None | use mysql | 0 | '0_0_0' | None |     0  |
2 | CHECKED | 1 | Audit completed | Set engine to innodb for table 'adaptive_office'.  
Set charset to one of 'utf8mb4' for table 'adaptive_office'.  
Set comments for table 'adaptive_office'.  
Column 'id' in table 'adaptive_office' have no comments.  
Column 'id' in table 'adaptive_office' is not allowed to been nullable.  
Set Default value for column 'id' in table 'adaptive_office'  
Set a primary key for table 'adaptive_office'. | CREATE TABLE adaptive_office(id int) 
| 0 | '0_0_1' | 127_0_0_1_3306_mysql |     0|

转载于:https://www.cnblogs.com/vickey-wu/p/9201582.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值