日期:2014-05-16  浏览次数:20475 次

Percona Server with XtraDB 5.5.21和handlersocket插件安装

1.新建MySQL用户和用户组
groupadd mysql
useradd -g mysql mysql


2.新建MySQL数据目录
mkdir -p /data/mysql/data/

mkdir -p /data/mysql/tablespace
mkdir -p /data/mysql/binlog/
mkdir -p /data/mysql/relaylog/
chown -R mysql:mysql /data/mysql/


3.安装MySQL
cd /usr/local/src/
wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.21-25.0/binary/linux/i686/Percona-Server-5.5.21-rel25.0-227.Linux.x86_64.tar.gz
tar zvxf Percona-Server-5.5.21-rel25.0-227.Linux.x86_64.tar.gz -C /usr/local/
cd /usr/local/Percona-Server-5.5.21-rel25.0-227.Linux.x86_64/scripts/
./mysql_install_db --basedir=/usr/local/Percona-Server-5.5.21-rel25.0-227.Linux.x86_64 --datadir=/data/mysql/data --user=mysql


4.MySQL的配置文件my.cnf,放在/et/目录

#BEGIN CONFIG INFO
#DESCR: 4GB RAM, InnoDB only, ACID, few connections, heavy queries
#TYPE: SYSTEM
#END CONFIG INFO

#
# This is a MySQL example config file for systems with 4GB of memory
# running mostly MySQL using InnoDB only tables and performing complex
# queries with few connections.
# 
# MySQL programs look for option files in a set of
# locations which depend on the deployment platform.
# You can copy this option file to one of those
# locations. For information about these locations, see:
# http://dev.mysql.com/doc/mysql/en/option-files.html
#
# In this file, you can use all long options that a program supports.
# If you want to know which options a program supports, run the program
# with the "--help" option.
#
# More detailed information about the individual options can also be
# found in the manual.
#

#
# The following options will be read by MySQL client applications.
# Note that only client applications shipped by MySQL are guaranteed
# to read this section. If you want your own MySQL client program to
# honor these values, you need to specify it as an option during the
# MySQL client library initialization.
#
[client]
#password	= [your_password]
# use loose for mysqlbinlog 
loose-character-set = utf8
port		= 3306
socket		= /tmp/mysql.sock

# *** Application-specific options follow here ***

#
# The MySQL server
#
[mysqld]

# generic configuration options
character_set_server = utf8
user        = mysql
port		= 3306
socket		= /tmp/mysql.sock
basedir     = /usr/local/Percona-Server-5.5.21-rel25.0-227.Linux.x86_64
datadir     = /data/mysql/data
log-error   = /data/mysql/mysql_error.log
pid-file    = /data/mysql/mysql.pid

skip-name-resolve
interactive_timeout = 288000
wait_timeout = 288000

# relay-log
relay-log-index = /data/mysql/relaylog/relaylog
relay-log-info-file = /data/mysql/relaylog/relaylog
relay-log = /data/mysql/relaylog/relaylog
expire_logs_days = 7

# back_log is the number of connections the operating system can keep in
# the listen queue, before the MySQL connection manager thread has
# processed them. If you have a very high connection rate and experience
# "connection refused" errors, you might need to increase this value.
# Check your OS documentation for the maximum value of this parameter.
# Attempting to set back_log higher than your operating system limit
# will have no effect.
back_log = 600

# Don't listen on a TCP/IP port at all. This can be a security
# enhancement, if all processes that need to connect to mysqld run
# on the same host.  All interaction with mysqld must be made via Unix
# sockets or named pipes.
# Note that using this option without enabling named pipes on Windows
# (via the "enable-named-pipe" option) will render mysqld useless!
#skip-networking

# The maximum amount of concurrent sessions the MySQL server will
# allow. One of these connections will be reserved for a user with
# SUPER privileges to allow the administrator to login even if the
# connection limit has been reached.
max_connections = 500

# Maximum amount of errors allowed per host. If this limit is reached,
# the host will b