git clone https://github.com/Meituan-Dianping/SQLAdvisor.git
yum install https://repo.percona.com/yum/percona-release-latest.noarch.rpm
yum -y install Percona-Server-shared-56
# find / -name libperconaserverclient_r.so.18
ln -s /usr/lib64/libperconaserverclient_r.so.18 /usr/lib64/libperconaserverclient_r.so
cd SQLAdvisor/
cmake -DBUILD_CONFIG=mysql_release -DCMAKE_BUILD_TYPE=debug -DCMAKE_INSTALL_PREFIX=/usr/local/sqlparser ./
make && make install
cd sqladvisor/
cmake -DCMAKE_BUILD_TYPE=debug ./
make
./sqladvisor --help
Usage:
sqladvisor [OPTION...] sqladvisor
SQL Advisor Summary
Help Options:
-?, --help Show help options
Application Options:
-f, --defaults-file sqls file
-u, --username username
-p, --password password
-P, --port port
-h, --host host
-d, --dbname database name
-q, --sqls sqls
-v, --verbose 1:output logs 0:output nothing
$> cat sql.cnf
[sqladvisor]
username=xx
password=xx
host=xx
port=xx
dbname=xx
sqls=sql1;sql2;sql3....
cmd: ./sqladvisor -f sql.cnf -v 1