mysql语句审核_mysql yearning-sql审核平台

安装yearning平台所需要的软件:

1 1>yum install -y epel-release wget gcc openssl-devel git python-pip net-tools2 2>yum install -y perl-IO-Socket-SSL perl-DBD-MySQL perl-Time-HiRes perl-TermReadKey perl-IO-Socket-SSL3 3>yum install -y zlib zlib-devel tar gzip bzip2 xz zip

4 4>wget https://www.percona.com/downloads/percona-toolkit/2.2.20/RPM/percona-toolkit-2.2.20-1.noarch.rpm

5 5>yum localinstall -y percona-toolkit-2.2.20-1.noarch.rpm6 6>yum install -y nginx7 7>安装mysql8 vim /etc/yum.repos.d/mysql.repo9

10 [mysql56-community-centos6]11 name=MySQL 5.6Community Server12 baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/6/$basearch/

13 enabled=1

14 gpgcheck=0

15

16 [mysql56-community-centos7]17 name=MySQL 5.6Community Server18 baseurl=http://repo.mysql.com/yum/mysql-5.6-community/el/7/$basearch/

19 enabled=1

20 gpgcheck=0

21

22 yum install -y mysql-community-server

8>安装python3.6

cd /opt

wget https://www.python.org/ftp/python/3.6.4/Python-3.6.4.tar.xz

tar xvf Python-3.6.4.tar.xz

cd Python-3.6.4

./configure && make && make install

9>下载yearning

cd /opt/

git clone https://github.com/cookieY/Yearning.git

cd /opt/Yearning/src

pip3 install -r requirements.tx

10>覆盖文件以支持inception链接mysql

cp -rp /opt/Yearning/install/connections.py /usr/local/lib/python3.6/site-packages/pymysql/

cp -rp /opt/Yearning/install/cursors.py /usr/local/lib/python3.6/site-packages/pymysql/

cp -rp /opt/Yearning/webpage/dist/* /usr/share/nginx/html/

11>启动mysql和nginx

service mysqld restart

service nginx restart

12>创建用户和数据库

grant all on *.* to root@localhost identified by 'baidu_mgame_2018';

flush privileges;

create database if not exists Yearning charset utf8;

13>复制deploy.conf文件

/opt/Yearning/src

cp -fr deploy.conf.template deploy.conf

vim deploy.conf

修改:

backuppassword=备份数据库密码

ipaddress = 服务器地址

password=数据库密码同backuppassword

14>创建yearning需要的表

cd /opt/Yearning/src

python3 manage.py makemigrations

python3 manage.py migrate15>设置yearning账号密码:echo "from core.models import Account; Account.objects.create_user(username='admin', password="baidu_mgame_2018", group='admin',is_staff=1)" |python3 manage.py shellecho "from core.models import grained;grained.objects.get_or_create(username='admin', permissions={'ddl': '1', 'ddlcon': [], 'dml': '1', 'dmlcon': [], 'dic': '1', 'diccon': [], 'dicedit': '0', 'query': '1', 'querycon': [], 'user': '1', 'base': '1', 'dicexport': '0', 'person': []})" | python3 manage.py shell

16>启动inception

1 /opt/Yearning/install/inception/bin/Inception --defaults-file=/opt/Yearning/install/inception/bin/inc.cnf &

17>启动yearning

cd /opt/Yearning/src

python3 manage.py runserver 0.0.0.0:8000 &

总结;

1、如果需要在修改表时使用osc需要在/opt/Yearning/install/inception/bin/inc.cnf修改:如下

inception_osc_on=1inception_osc_print_sql=1inception_osc_print_none=0inception_osc_bin_dir=/user/bin #用于指定pt-online-schema-change脚本的位置,不可修改,在配置文件中设置

inception_osc_check_interval=5 #对应OSC参数--check-interval,意义是Sleep time between checks for --max-lag.

inception_osc_chunk_size=1000 #对应OSC参数--chunk-size

inception_osc_chunk_size_limit=4 #对应OSC参数--chunk-size-limit

inception_osc_chunk_time=0.1 #对应OSC参数--chunk-timeinception_osc_critical_thread_connected=1000 #对应参数--critical-load中的thread_connected部分

inception_osc_critical_thread_running=800 #对应参数--critical-load中的thread_running部分

inception_osc_drop_new_table=1 #对应参数--[no]drop-new-table

inception_osc_drop_old_table=1 #对应参数--[no]drop-old-table

inception_osc_max_lag=3 #对应参数--max-lag

inception_osc_max_thread_connected=1000 #对应参数--max-load中的thread_connected部分

inception_osc_max_thread_running=800 #对应参数--max-load中的thread_running部分

inception_osc_min_table_size=16 #

2、在使用admin时无法生成数据库字典

是由于没有给admin赋予生成数据库字典的权限,需要赋予权限后才能生成字典

3、官方文档

http://supermancookie.com/Yearning-document/install/

你可能感兴趣的:(mysql语句审核)