首先下载安装包:
wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-client-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm
&& wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-devel-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm
&& wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-server-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm
&& wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-shared-55-5.5.35-rel33.0.611.rhel6.x86_64.rpm
&& wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.35-rel33.0/RPM/rhel6/x86_64/Percona-Server-shared-compat-5.5.35-rel33.0.611.rhel6.x86_64.rpm
然后安装rpm包:
rpm -ivh MySQL-server-5.5.34-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-client-5.5.34-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-devel-5.5.34-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-shared-5.5.34-1.linux2.6.x86_64.rpm
rpm -ivh MySQL-shared-compat-5.5.34-1.linux2.6.x86_64.rpm
期间可能会报asio的错,这时需运行
yum -y install libaio*
安装。
如报 conflicts with file from package mysql-libs类似冲突,可以执行yum -y remove mysql-libs*
移除冲突包
groupadd mysql && useradd -g mysql mysql
mkdir /data/mysql -p && chown -R mysql.mysql /data/mysql/
mysql_install_db --datadir=/data/mysql && chown -R mysql.mysql /data/mysql/
编辑/etc/my.cnf
[mysql]
prompt=[\\h][\\u]@\\d\\r:\\m:\\s>
no-auto-rehash
[client]
port=3306
socket=/data/mysql/mysql.sock
[mysqld]
user=mysql
port=3306
slow_query_log_file=mysql.slow
log-bin=mysql-bin
binlog-format=STATEMENT
skip-name-resolve
log-error=mysql.err
default-storage-engine=INNODB
character-set-server=utf8
long_query_time=1
slow_query_log=1
innodb_data_file_path=ibdata1:100M:autoextend
innodb_log_file_size=1G
innodb_file_per_table=1
datadir=/data/mysql/
innodb_data_home_dir=/data/mysql/
innodb_log_group_home_dir=/data/mysql/
pid-file=/data/mysql/mysql.pid
socket=/data/mysql/mysql.sock
innodb_buffer_pool_size=512M
然后启动:
/etc/init.d/mysql start