Wednesday, December 01, 2010

Install sqlstats plugin on MySQL

sqlstats is a project for a MySQL 5.5 and up audit plugin. We can download and install.#
# ./configure --with-mysqlsrc=/root/mysql-5.5.7-rc --with-mysql=/usr/local/MySQL-5.5
# make
# make install
/usr/bin/install -c .libs/libsqlstats.so /usr/local/MySQL-5.5/lib/plugin/sqlstats.so

# cat install.sql
INSTALL PLUGIN sqlstats SONAME 'sqlstats.so';
INSTALL PLUGIN sqlstats_topsql SONAME 'sqlstats.so';
INSTALL PLUGIN sqlstats_lastsql SONAME 'sqlstats.so';
SET GLOBAL sqlstats_enable = 1;

# mysql -u root --force < install.sql
Check variables.
mysql> show variables like 'sqlstat%';
+--------------------+-------+
| Variable_name | Value |
+--------------------+-------+
| sqlstats_enable | ON |
| sqlstats_lru_stmts | 50 |
| sqlstats_top_stmts | 50 |
+--------------------+-------+
we can read more

No comments: