Percona MySQL installation tutorial

From Wiki

Jump to: navigation, search

This tutorial covers the steps that should be followed in order to install Percona MySQL on a CentOS/RHEL server and adjust 1H Hive software to gather MySQL statistics for the server.

How to install

 rpm -Uhv$(uname -i).rpm
 root@grumpy [~]# mysql -V
 mysql  Ver 14.12 Distrib 5.0.92, for unknown-linux-gnu (x86_64) using readline 5.1
 root@grumpy [~]# 
 root@grumpy [~]# if [ -d /svcstop ]; then touch /svcstop/mysql; fi
 root@grumpy [~]# /etc/init.d/mysql stop
 Shutting down MySQL.                                       [  OK  ]
 root@grumpy [~]# 
 root@grumpy [~]# cp -a /var/lib/mysql /var/lib/mysql.backup
 root@grumpy [~]# 
 root@grumpy [~]# mysql -A -sN -e "show databases" > active.db.list.log
 root@grumpy [~]# rpm -qa | grep -i "mysql.*server"
 root@grumpy [~]# yum remove MySQL-server-5.0.92-0.glibc23
 yum --disableexcludes=main install Percona-SQL-server-SET-CORRECT-VERSION-HERE
 root@grumpy [~]# mysql -A
 root@sgded-bizserver [~]# tail -f /var/lib/mysql/$(hostname).err
 mysql -A -sN -e "show databases" > new.db.list.log
 for dbname in $(<active.db.list.log); do
       if ( ! grep "^$dbname$" new.db.list.log >> /dev/null ); then
               echo "Database $dbname is missing from show databases"
 sed -i '/userstat_running/D' /etc/my.cnf && echo "userstat_running=1" >> /etc/my.cnf && /etc/init.d/mysql restart

For Percona 5.5.10 or newer the variable is renamed to userstat so you should run:

sed -i '/userstat/D' /etc/my.cnf && echo "userstat=1" >> /etc/my.cnf && /etc/init.d/mysql restart

Keep in mind that the userstat_running/userstat variable should be after [mysqld] definition and before any other [] definitions.

 root@grumpy [~]# mysql -e 'show variables like "userstat_running"'
 | Variable_name    | Value |
 | userstat_running | ON    | 

For Percona 5.5.10:

root@grumpy [~]# mysql -e 'show variables like "userstat"'

If in the above output you see OFF, this means that the userstat_running variable is in the wrong place in /etc/my.cnf.

 root@grumpy [~]# mysql -A -sN information_schema -e "select * from user_statistics;"
touch /etc/mysqldisable
touch /etc/mysqlupdisable
 root@grumpy [~]# if [ -f /svcstop/mysql ]; then rm -f /svcstop/mysql; fi

How to revert

Personal tools