Centos7.4 安装 Inception

Cetos7.4系统 环境设置

yuminstallcmakencurses-develgccgcc-c++openssl-devel
yumremovebison-y


cd/usr/local/src/
wgethttp://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz
tar-zxvfm4-1.4.18.tar.gz
cdm4-1.4.18
./configure&&make&&makeinstall



wgethttp://ftp.gnu.org/gnu/bison/bison-2.5.tar.gz
tar-zxvfbison-2.5.tar.gz
cdbison-2.5/
./configure
vim./lib/stdio.h
删除这一行_GL_WARN_ON_USE(gets,"getsisasecurityhole-usefgetsinstead");
./configure
make&&makeinstall
[root@1bison-2.5]#bison-V
bison(GNUBison)2.5





cd/usr/local/
wgethttps://github.com/mysql-inception/inception/archive/master.zip
unzipmaster.zip
mvinception-master/inception
mvmaster.zipinception.zip
mvinception.zip/usr/local/src/
shinception_build.shbuilddirlinux


配置文件

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


启动测试

nohup/usr/local/inception/builddir/mysql/bin/Inception--defaults-file=inc.cnf>/dev/null2>&1&


mysql-uroot-h127.0.0.1-P6669

inceptiongetvariables;


安装测试完成。

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'

#/usr/bin/python
#_*_coding:utf-8_*_
importpymysql.cursors
sql='/*--user=root;--password=123456;--host=192.168.10.81;--execute=1;--port=3306;*/\
inception_magic_start;\
usehequan;\
CREATETABLEadaptive_office(idint);\
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])foriincursor.description)
row_num=0
forresultinresults:
row_num=row_num+1
print('*'.ljust(27,'*'),row_num,'.row','*'.ljust(27,'*'))
row=map(lambdax,y:(x,y),(i[0]foriincursor.description),result)
foreach_columninrow:
ifeach_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()
exceptpymysql.Errorase:
print("MysqlError%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 :

相关文章

linux下开机自启: 在/etc/init.d目录下新建文件elasticsear...
1、因为在centos7中/etc/rc.d/rc.local的权限被降低了,所以...
最简单的查看方法可以使用ls -ll、ls-lh命令进行查看,当使用...
ASP.NET Core应用程序发布linux在shell中运行是正常的。可一...
设置时区(CentOS 7) 先执行命令timedatectl status|grep &...
vim /etc/sysconfig/network-scripts/ifcfg-eth0 B...