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 :
原文链接:https://www.f2er.com/centos/375002.html