一、下載 http://www.percona.com/downloads/Percona-Server-5.5/ Percona-Server-5.5.33-31.1 選擇 binary 選擇linux 選擇x86_64 二、文檔: http://www.percona.com/doc/perco ...
一、下載
http://www.percona.com/downloads/Percona-Server-5.5/
選擇 binary
選擇linux
選擇x86_64
二、文檔:
http://www.percona.com/doc/percona-server/5.5/
http://dev.mysql.com/doc/refman/5.5/en/binary-installation.html --主要參考這篇文檔
三、安裝
[root@tthost3 ~]# mv Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz /usr/local/
安裝要放的真是路徑
[root@tthost3 ~]# groupadd mysql
[root@tthost3 ~]# useradd –r –g mysql mysql
[root@tthost3 ~]# mv Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz /usr/local/
[root@tthost3 ~]# cd /usr/local
[root@tthost3 ~]# tar zxvf Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz
[root@tthost3 local]# ll
total 63104
drwxr-xr-x 2 root root 4096 Apr 5 01:34 bin
drwxr-xr-x 2 root root 4096 Oct 1 2009 etc
drwxr-xr-x 2 root root 4096 Oct 1 2009 games
drwxr-xr-x 2 root root 4096 Oct 1 2009 include
drwxr-xr-x 2 root root 4096 Oct 1 2009 lib
drwxr-xr-x 2 root root 4096 Oct 1 2009 lib64
drwxr-xr-x 2 root root 4096 Oct 1 2009 libexec
drwxr-xr-x 14 root root 4096 Aug 27 2013 Percona-Server-5.5.33-rel31.1-566.Linux.x86_64
-rw-r--r-- 1 root root 64459501 Jun 30 12:44 Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz
drwxr-xr-x 2 root root 4096 Oct 1 2009 sbin
drwxr-xr-x 4 root root 4096 Apr 4 23:39 share
drwxr-xr-x 2 root root 4096 Oct 1 2009 src
[root@tthost3 local]# ln -s /usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64 mysql
[root@tthost3 local]# ll
total 63104
drwxr-xr-x 2 root root 4096 Apr 5 01:34 bin
drwxr-xr-x 2 root root 4096 Oct 1 2009 etc
drwxr-xr-x 2 root root 4096 Oct 1 2009 games
drwxr-xr-x 2 root root 4096 Oct 1 2009 include
drwxr-xr-x 2 root root 4096 Oct 1 2009 lib
drwxr-xr-x 2 root root 4096 Oct 1 2009 lib64
drwxr-xr-x 2 root root 4096 Oct 1 2009 libexec
lrwxrwxrwx 1 root root 57 Jun 30 12:55 mysql -> /usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64
drwxr-xr-x 14 root root 4096 Aug 27 2013 Percona-Server-5.5.33-rel31.1-566.Linux.x86_64
-rw-r--r-- 1 root root 64459501 Jun 30 12:44 Percona-Server-5.5.33-rel31.1-566.Linux.x86_64.tar.gz
drwxr-xr-x 2 root root 4096 Oct 1 2009 sbin
drwxr-xr-x 4 root root 4096 Apr 4 23:39 share
drwxr-xr-x 2 root root 4096 Oct 1 2009 src
[root@tthost3 local]# cd mysql/
[root@tthost3 mysql]# chown -R mysql .
[root@tthost3 mysql]# chgrp -R mysql .
[root@tthost3 mysql]# ll
total 80
drwxr-xr-x 2 mysql mysql 4096 Aug 27 2013 bin
-rw-r--r-- 1 mysql mysql 17987 Aug 27 2013 COPYING
-rw-r--r-- 1 mysql mysql 1703 Aug 27 2013 COPYING-jemalloc
drwxr-xr-x 3 mysql mysql 4096 Aug 27 2013 data
drwxr-xr-x 2 mysql mysql 4096 Aug 27 2013 docs
drwxr-xr-x 4 mysql mysql 4096 Aug 27 2013 include
-rw-r--r-- 1 mysql mysql 301 Aug 27 2013 INSTALL-BINARY
drwxr-xr-x 3 mysql mysql 4096 Aug 27 2013 lib
drwxr-xr-x 4 mysql mysql 4096 Aug 27 2013 man
drwxr-xr-x 3 mysql mysql 4096 Aug 27 2013 mysql
drwxr-xr-x 10 mysql mysql 4096 Aug 27 2013 mysql-test
-rw-r--r-- 1 mysql mysql 2496 Aug 27 2013 README
drwxr-xr-x 2 mysql mysql 4096 Aug 27 2013 scripts
drwxr-xr-x 27 mysql mysql 4096 Aug 27 2013 share
drwxr-xr-x 4 mysql mysql 4096 Aug 27 2013 sql-bench
drwxr-xr-x 3 mysql mysql 4096 Aug 27 2013 support-files
[root@tthost3 mysql]# ./scripts/mysql_install_db --user=mysql
Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
./bin/mysqladmin -u root password 'new-password'
./bin/mysqladmin -u root -h tthost3 password 'new-password'
Alternatively you can run:
./bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd . ; ./bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd ./mysql-test ; perl mysql-test-run.pl
Please report any problems with the ./bin/mysqlbug script!
Percona recommends that all production deployments be protected with a support
contract (http://www.percona.com/mysql-suppport/) to ensure the highest uptime,
be eligible for hot fixes, and boost your team's productivity.
以上有幾點很重要!
[root@tthost3 mysql]# chown -R root .
[root@tthost3 mysql]# ll
total 80
drwxr-xr-x 2 root mysql 4096 Aug 27 2013 bin
-rw-r--r-- 1 root mysql 17987 Aug 27 2013 COPYING
-rw-r--r-- 1 root mysql 1703 Aug 27 2013 COPYING-jemalloc
drwxr-xr-x 5 root mysql 4096 Jun 30 12:59 data
drwxr-xr-x 2 root mysql 4096 Aug 27 2013 docs
drwxr-xr-x 4 root mysql 4096 Aug 27 2013 include
-rw-r--r-- 1 root mysql 301 Aug 27 2013 INSTALL-BINARY
drwxr-xr-x 3 root mysql 4096 Aug 27 2013 lib
drwxr-xr-x 4 root mysql 4096 Aug 27 2013 man
drwxr-xr-x 3 root mysql 4096 Aug 27 2013 mysql
drwxr-xr-x 10 root mysql 4096 Aug 27 2013 mysql-test
-rw-r--r-- 1 root mysql 2496 Aug 27 2013 README
drwxr-xr-x 2 root mysql 4096 Aug 27 2013 scripts
drwxr-xr-x 27 root mysql 4096 Aug 27 2013 share
drwxr-xr-x 4 root mysql 4096 Aug 27 2013 sql-bench
drwxr-xr-x 3 root mysql 4096 Aug 27 2013 support-files
[root@tthost3 mysql]# chown -R mysql data
[root@tthost3 mysql]# ll
total 80
drwxr-xr-x 2 root mysql 4096 Aug 27 2013 bin
-rw-r--r-- 1 root mysql 17987 Aug 27 2013 COPYING
-rw-r--r-- 1 root mysql 1703 Aug 27 2013 COPYING-jemalloc
drwxr-xr-x 5 mysql mysql 4096 Jun 30 12:59 data
下麵的這些是可選的:
[root@tthost3 mysql]# cp support-files/my-medium.cnf /etc/my.cnf
[root@tthost3 mysql]# ./bin/mysqld_safe --user=mysql &
[1] 3813
[root@tthost3 mysql]# 140630 13:07:39 mysqld_safe Logging to '/usr/local/mysql/data/tthost3.err'.
140630 13:07:39 mysqld_safe Starting mysqld daemon with databases from /usr/local/mysql/data
[root@tthost3 mysql]# ps -ef | grep mysql
root 3813 3607 0 13:07 pts/2 00:00:00 /bin/sh ./bin/mysqld_safe --user=mysql
mysql 4067 3813 2 13:07 pts/2 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --log-error=/usr/local/mysql/data/tthost3.err --pid-file=/usr/local/mysql/data/tthost3.pid --socket=/tmp/mysql.sock --port=3306
root 4088 3607 0 13:07 pts/2 00:00:00 grep mysql
以下的選項是可選的:
編輯mysql.server
將Percona-Server-5.5.33-rel31.1-566.Linux.x86_64替換成mysql 真實路徑
[root@tthost3 mysql]# vi support-files/mysql.server
修改前:
mysqld_pid_file_path=
if test -z "$basedir"
then
basedir=/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64
bindir=/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64/bin
if test -z "$datadir"
then
datadir=/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64/data
fi
sbindir=/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64/bin
libexecdir=/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64/bin
else
修改後:
mysqld_pid_file_path=
if test -z "$basedir"
then
basedir=/usr/local/mysql
bindir=/usr/local/mysql/bin
if test -z "$datadir"
then
datadir=/usr/local/mysql/data
fi
sbindir=/usr/local/mysql/bin
libexecdir=/usr/local/mysql/bin
else
[root@tthost3 mysql]# cp support-files/mysql.server /etc/init.d/mysqld
[root@tthost3 mysql]# chkconfig --add mysqld
[root@tthost3 mysql]# chkconfig --list |grep mysqld
mysqld 0:off 1:off 2:on 3:on 4:on 5:on 6:off
[root@tthost3 mysql]#
[root@tthost3 mysql]# service mysqld stop
Shutting down MySQL (Percona Server)..140630 13:17:40 mysqld_safe mysqld from pid file /usr/local/mysql/data/tthost3.pid ended
[ OK ]
[1]+ Done ./bin/mysqld_safe --user=mysql
[root@tthost3 mysql]# ps -ef | grep mysql
root 4194 3607 0 13:18 pts/2 00:00:00 grep mysql
[root@tthost3 mysql]# service mysqld start
Starting MySQL (Percona Server). [ OK ]
[root@tthost3 mysql]# ps -ef | grep mysql
root 4206 1 0 13:18 pts/2 00:00:00 /bin/sh /usr/local/mysql/bin/mysqld_safe --datadir=/usr/local/mysql/data --pid-file=/usr/local/mysql/data/tthost3.pid
mysql 4471 4206 1 13:18 pts/2 00:00:00 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/mysql/plugin --user=mysql --log-error=/usr/local/mysql/data/tthost3.err --pid-file=/usr/local/mysql/data/tthost3.pid --socket=/tmp/mysql.sock --port=3306
root 4496 3607 0 13:18 pts/2 00:00:00 grep mysql
安裝完成!
另外有個地方需要註意一下,我們的實際安裝路徑是:
/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64
/usr/local/mysql只是做了一個軟鏈接
啟動腳本中,mysqld,mysqld_safe,mysql.server腳本中basedir,datadir是預設在
/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64目錄下麵,就是說用腳本可以直接啟動,因為percona預設建議是安裝在這個下麵:
/usr/local/Percona-Server-5.5.33-rel31.1-566.Linux.x86_64
這裡只是做了mysql的一個軟鏈接和oracle mysql相容下目錄而已 ,如果要把mysql.server拷貝到/etc/init.d/目錄下,腳本中目錄路徑也不一定要修改的,怎樣都能啟動:
Service mysqld start