centos 源码编译安装 percona 5.5

下载percona源码

http://www.percona.com/downloads/Percona-Server-5.5/LATEST/

我下载的是 Percona-Server-5.5.21-rel25.0.tar.gz

tar zxvf Percona-Server-5.5.21-rel25.0.tar.gz
cd Percona-Server-5.5.21-rel25.0
cmake . -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr/local/percona -DWITH_EXTRA_CHARSETS=all -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_PARTITION_STORAGE_ENGINE=1 -DWITH_READLINE=1 -DWITH_SSL=yes
(cmake -LHA 可以查看cmake可以使用的参数)
make && make install
mkdir /usr/local/percona/etc
cp support-files/my-medium.cnf /usr/local/percona/etc/my.cnf
vim /usr/local/percona/etc/my.cnf

因为我的虚拟机已经有了运行3306端口的mysql实例,将些/usr/local/percona/etc/my.cnf的端口改为3506、socket改为/tmp/percona.sock
如果要使用innodb引擎(percona分支中的innodb实际就是说的XtraDB引擎,XtraDB引擎向下完全兼容InnoDB引擎),将my.cnf中这句【# Uncomment the following if you are using InnoDB tables】以下的所有innodb相关的注释全部取消掉即可,如下(此处仅为演示,具体的数值,请参考相关的说明文档)

# Uncomment the following if you are using InnoDB tables
innodb_data_home_dir = /usr/local/percona/data
innodb_data_file_path = ibdata1:10M:autoextend
innodb_log_group_home_dir = /usr/local/percona/data
# You can set .._buffer_pool_size up to 50 - 80 %
# of RAM but beware of setting memory usage too high
innodb_buffer_pool_size = 16M
innodb_additional_mem_pool_size = 2M
# Set .._log_file_size to 25 % of buffer pool size
innodb_log_file_size = 5M
innodb_log_buffer_size = 8M
innodb_flush_log_at_trx_commit = 1
innodb_lock_wait_timeout = 50

初始数据库

/usr/local/percona/scripts/mysql_install_db --basedir=/usr/local/percona --datadir=/usr/local/percona/data --user=mysql

启动percona数据库实例

/usr/local/percona/bin/mysqld_safe --defaults-file=/usr/local/percona/etc/my.cnf > /dev/null 2>&1 &

初始化

/usr/local/percona/bin/mysqladmin -u root -P 3506 -h 127.0.0.1 password "123456"

再使用下面的命令即可进入实例

/usr/local/percona/bin/mysql -h 127.0.0.1 -u root -P 3506 -p123456

安装Percona自带的HandleSocket插件

cd storage/HandlerSocket-Plugin-for-MySQL/
./configure --with-mysql-source=/root/tmp/Percona-Server-5.5.21-rel25.0 --with-mysql-bindir=/usr/local/percona/bin --with-mysql-plugindir=/usr/local/percona/lib/plugin 
make
make install
/usr/local/percona/bin/mysql -h 127.0.0.1 -u root -P 3506 -p123456
mysql> install plugin handlersocket SONAME "handlersocket.so";
mysql> show plugins;

发表回复

您的电子邮箱地址不会被公开。

*

code

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据