--------- Percona 5.5.20二进制安装步骤 -----------

Percona版本:Percona-Server-5.5.11-rel20.2-116.Linux.x86_64.tar.gz
wget http://www.percona.com/redir/downloads/Percona-Server-5.5/Percona-Server-5.5.11-20.2/Linux/binary/Percona-Server-5.5.11-rel20.2-116.Linux.x86_64.tar.gz


tar zvxf Percona-Server-5.5.11-rel20.2-116.Linux.x86_64.tar.gz

mv Percona-Server-5.5.11-rel20.2-116.Linux.x86_64 /usr/local/mysql

groupadd mysql
useradd -r -g mysql mysql

cd /usr/local/mysql/

chown -R mysql .
chgrp -R mysql .

scripts/mysql_install_db --user=mysql
chown -R root .
chown -R mysql data
cp support-files/my-medium.cnf /usr/local/my.cnf




cp support-files/mysql.server /etc/init.d/mysqld

cp /usr/local/mysql/bin/mysql  /usr/sbin/

vi /etc/init.d/mysqld

--------文件 65 - 74 行,原始内容
then
  basedir=/usr/local/mysql
  bindir=/usr/local/Percona-Server-5.5.11-rel20.2-116.Linux.x86_64/bin
  if test -z "$datadir"
  then
    datadir=/usr/local/Percona-Server-5.5.11-rel20.2-116.Linux.x86_64/data
  fi
  sbindir=/usr/local/Percona-Server-5.5.11-rel20.2-116.Linux.x86_64/bin
  libexecdir=/usr/local/Percona-Server-5.5.11-rel20.2-116.Linux.x86_64/bin
else

-------65 - 74 行,修改后

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

-------------------

chmod 755 /etc/rc.d/init.d/mysqld

chkconfig --add mysqld

ulimit -HSn 65536

-------- 启动 -----------
方式1:
bin/mysqld_safe --user=mysql &
方式2:
service mysqld start
方式3:
/usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/my.cnf --user=root &  //指定my.cnf方式启动
-------------------------

ln -s /usr/local/mysql/data/mysql.sock /tmp/mysql.sock

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'

/usr/local/mysql/bin/mysql -u root -p


GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "foobet6543210+hk"; //fb123456

FLUSH PRIVILEGES;

#编辑文件
[root@web01 ~]# vi /etc/profile 
------------------------------------------------------------
# Set mysql
MYSQL_HOME=/usr/local/mysql
PATH=$PATH:$MYSQL_HOME/bin
export MYSQL_HOME PATH CLASSPATH

------------------------------------------------------------
# source /etc/profile



*********** 数据导入导出 ***************


导出
mysqldump -h localhost -u root -p mydb > mydb.sql

将数据库mydb中的mytable导出
mysqldump -h localhost -u root -p mydb mytable>mytable.sql

将数据库mydb的结构导出
mysqldump -h localhost -u root -p mydb --add-drop-table > mydb_stru.sql


导入
mysql -h localhost -u root -p mydb2 < mydb2.sql