天天看點

編譯安裝MySQL衍生版 Percona Server

Percona 為 MySQL 資料庫伺服器進行了改進,在功能和性能上較 MySQL 有着很顯著的提升。該版本提升了在高負載情況下的 InnoDB 的性能、為 DBA 提供一些非常有用的性能診斷工具;另外有更多的參數和指令來控制伺服器行為。

Percona Server 隻包含 MySQL 的伺服器版,并沒有提供相應對 MySQL 的 Connector 和 GUI 工具進行改進。

Percona Server 使用了一些 google-mysql-tools, Proven Scaling, Open Query 對 MySQL 進行改造。

官方性能測試對比:

<a href="http://www.percona.com/software/percona-server/benchmarks/">http://www.percona.com/software/percona-server/benchmarks/</a>

一、下載下傳相關軟體

bison( bison是一個自由軟體,用于自動生成文法分析器程式,實際上可用于所有常見的作業系統)

編譯工具cmake(<b>MySQL5.5</b><b>版本改為跨平台的cmake編譯</b>)

Percona-Server-5.5.22-rel25.2

二、安裝依賴軟體:

[root@DBs software]# yum install gcc gcc-c++ ncurses ncurses-devel -y

[root@DBs software]# tar zxvf cmake-2.8.8.tar.gz

[root@DBs software]# tar bison-2.5.tar.gz

[root@DBs software]# cd cmake-2.8.8

[root@DBs cmake-2.8.8]# ./bootstrap &amp;&amp; make &amp;&amp; make install

[root@DBs cmake-2.8.8]# cd ../bison-2.5

[root@DBs bison-2.5]# ./config &amp;&amp; make &amp;&amp; make install

[root@DBs bison-2.5]# cd ..

[root@DBs software]# tar zxvf Percona-Server-5.5.22-rel25.2

[root@DBs software]# cd Percona-Server-5.5.22-rel25.2

添加mysql賬戶

[root@DBs Percona-Server-5.5.22-rel25.2]# /usr/sbin/groupadd mysql

[root@DBs Percona-Server-5.5.22-rel25.2]# /usr/sbin/useradd -g mysql mysql

Cmke編譯環境

[root@DBs Percona-Server-5.5.22-rel25.2]# cmake -DCMAKE_INSTALL_PREFIX=/opt/hx/mysql \

&gt; -DSYSCONFDIR=/opt/hx/mysql/etc \

&gt; -DMYSQL_DATADIR=/opt/hx/mysql/data \

&gt; -DDEFAULT_CHARSET=gbk \

&gt; -DDEFAULT_COLLATION=gbk_chinese_ci \

&gt;     -DWITH_INNOBASE_STORAGE_ENGINE=1 \

&gt; -DWITH_PERFSCHEMA_STORAGE_ENGINE=1 \

&gt; -DWITH_PARTITION_STORAGE_ENGINE=1

參數這裡不再詳解,參看編譯工具configure向cmake過渡指南:

<a href="http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide">http://forge.mysql.com/wiki/Autotools_to_CMake_Transition_Guide</a>

如果編譯有錯誤重新編譯需要先做如下操作:

[root@DBs Percona-Server-5.5.22-rel25.2]# make clean

[root@DBs Percona-Server-5.5.22-rel25.2]# rm -f CMakeCache.txt

編譯安裝Percona-Server:

[root@DBs Percona-Server-5.5.22-rel25.2]# make &amp;&amp; make install

[root@DBs Percona-Server-5.5.22-rel25.2]# cd support-files/

[root@DBs support-files]# cp  my-large.cnf /etc/my.cnf

[root@DBs support-files]# cp mysql.server /etc/init.d/mysqld

[root@DBs support-files]# chmod 755 /etc/init.d/mysqld

[root@DBs support-files]# /opt/hx/mysql/scripts/mysql_install_db --defaults-file=/opt/hx/mysql/etc/my.cnf  --basedir=/opt/hx/mysql/ --datadir=/opt/hx/mysql/data/ --user=mysql

[root@DBs support-files]# /opt/hx/mysql//bin/mysqld_safe --user=mysql&amp;

驗證mysql啟動狀态:

[root@DBs ~]# /etc/init.d/mysqld status

MySQL (Percona Server) running (32611)                     [  OK  ]

[root@DBs ~]# netstat  -nlt|grep 3306

tcp        0      0 :::3306                     :::*                        LISTEN

使用mysqld腳本管理 mysql參數:

[root@DBs ~]# /etc/init.d/mysqld

Usage: mysqld  {start|stop|restart|reload|force-reload|status}  [ MySQL (Percona Server) options ]

本文轉自pandazhai 51CTO部落格,原文連結:http://blog.51cto.com/dreamway/1045561

繼續閱讀