• 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|
    
  • 相关阅读:
    代码操作
    购物车
    利息计算器
    生成海报
    知识库
    JavaScript处理字符串--参照W3C
    C#输入排序-冒泡
    enum举例
    C# 表达式计算器----数据结构
    C# 测试单词的完美度
  • 原文地址:https://www.cnblogs.com/vickey-wu/p/9201582.html
Copyright © 2020-2023  润新知