Centos7.4 安装 Inception

Cetos7.4系统  环境设置

1
2
yum  install  cmake   ncurses-devel gcc gcc-c++  openssl-devel
yum  remove bison -y


1
2
3
4
5
6
7
8
9
10
11
12
cd  /usr/local/src/
wget http: //ftp .gnu.org /gnu/m4/m4-1 .4.18. tar .gz
tar  -zxvf m4-1.4.18. tar .gz
cd  m4-1.4.18
. /configure  &&  make  &&  make  install
 
 
 
wget  http: //ftp .gnu.org /gnu/bison/bison-2 .4. tar .gz
tar  -zxvf bison-2.4. tar .gz
cd  bison-2.4/
. /configure





1
2
3
4
5
6
7
cd  /usr/local/
wget https: //github .com /mysql-inception/inception/archive/master .zip
unzip master.zip
mv  inception-master/  inception
mv  master.zip inception.zip
mv  inception.zip    /usr/local/src/
sh inception_build.sh builddir  linux



配置文件

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
vim   inc.cnf
[inception]
general_log=1
general_log_file=inception. log
port=6669
socket=/tmp/mysql.sock
character-set-client-handshake=0
character-set-server=utf8
inception_remote_system_password=root
inception_remote_system_user=123456
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


启动测试

1
2
3
4
5
6
nohup     /usr/local/inception/builddir/mysql/bin/Inception   --defaults- file =inc.cnf   > /dev/null   2>&1   &
 
 
mysql -uroot -h127.0.0.1 -P6669
 
inception get variables;


安装测试完成。


python3  

由于python3使用的pymysql模块里并未兼容inception返回的server信息,因此需要编辑/path/to/python3/lib/python3.4/site-packages/pymysql/connections.py:

在if int(self.server_version.split('.', 1)[0]) >= 5: 这一行之前加上以下这一句并保存,记得别用tab键用4个空格缩进:

self.server_version = '5.6.24-72.2-log'

pymysql.png

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#/usr/bin/python
#_*_ coding:utf-8  _*_
import  pymysql.cursors
sql='/*--user=root;--password=123456;--host=192.168.10.81;--execute=1;--port=3306;*/\
inception_magic_start;\
use hequan;\
CREATE TABLE adaptive_office( id  int);\
inception_magic_commit;'
try:
     conn=pymysql.connect(host= '127.0.0.1' ,user= '' , passwd = '' ,db= '' ,port=6669)
     cursor=conn.cursor()
     cursor.execute(sql)
     results = cursor.fetchall()
     column_name_max_size=max(len(i[0])  for  in  cursor.description)
     row_num=0
     for  result  in  results:
         row_num=row_num+1
         print( '*' .ljust(27, '*' ),row_num, '.row' '*' .ljust(27, '*' ))
         row = map(lambda x, y: (x,y), (i[0]  for  in  cursor.description), result)
         for  each_column  in  row:
             if  each_column[0] !=  'errormessage' :
                 print(each_column[0].rjust(column_name_max_size), ":" ,each_column[1])
             else :   
                 print(each_column[0].rjust(column_name_max_size), ':' ,each_column[1].replace( '\n' , '\n' .ljust(column_name_max_size+4)))
     cursor.close()
     conn.close()
except pymysql.Error as e:
      print( "Mysql Error %d: %s"  % (e.args[0], e.args[1]))


*************************** 1 .row ***************************

           ID : 1

        stage : CHECKED

     errlevel : 0

  stagestatus : Audit completed

errormessage : None

          SQL : use hequan

Affected_rows : 0

     sequence : '0_0_0'

backup_dbname : None

execute_time : 0

      sqlsha1 :

*************************** 2 .row ***************************

           ID : 2

        stage : CHECKED

     errlevel : 2

  stagestatus : Audit completed

errormessage : Table 'adaptive_office' already exists.

                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'.

          SQL : CREATE TABLE adaptive_office(id int)

Affected_rows : 0

     sequence : '0_0_1'

backup_dbname : 192_168_10_81_3306_hequan

execute_time : 0

      sqlsha1 :










本文转自 295631788 51CTO博客,原文链接:http://blog.51cto.com/hequan/2052602,如需转载请自行联系原作者
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值