mysql繁衍。。percona 二进制数据库的安装配置。

一、解压

tar xvf /root/Percona-Server-5.5.13-rel20.4-138.Linux.x86_64.tar.gz -C /usr/src/
mv /usr/src/Percona-Server-5.5.13-rel20.4-138.Linux.x86_64/ /usr/local/mysql

二、创建mysql系统用户

groupadd mysql
useradd -g mysql mysql

三、初始化

[root@slave mysql]# ./scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/

四、授权

[root@slave mysql]# chown mysql:mysql ./* -R

五、拷贝配置文件

[root@slave mysql]# cp support-files/my-medium.cnf /etc/my.cnf
[root@slave mysql]# vim /etc/my.cnf

  1. [mysqld]  
  2. port            = 3306 
  3. socket          = /tmp/mysql.sock            ----------在这行下面添加以下内容-----------------  
  4.  
  5. datadir         = /usr/local/mysql/data  
  6. user            = mysql 
  7. basedir         = /usr/local/mysql  
  8. pid-file        = /usr/local/mysql/mysql.pid  
  9. log_bin_trust_function_creators=1 
  10. character_set_server = utf8 

六、拷贝启动脚本并授权

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

[root@slave mysql]# vim /etc/init.d/mysqld   (修改路径)

  1. mysqld_pid_file_path=  
  2. if test -z "$basedir"  
  3. then  
  4.   basedir=/usr/local/mysql  
  5.   bindir=/usr/local/mysql/bin  
  6.   if test -z "$datadir"  
  7.   then  
  8.     datadir=/usr/local/mysql/data  
  9.   fi  
  10.   sbindir=/usr/local/mysql/bin  
  11.   libexecdir=/usr/local/mysql/bin  
  12. else  
  13.   bindir="$basedir/bin" 
  14.   if test -z "$datadir"  
  15.   then  
  16.     datadir="$basedir/data" 
  17.   fi  
  18.   sbindir="$basedir/sbin" 
  19.   libexecdir="$basedir/libexec" 
  20. fi  

七、启动

[root@slave mysql]# /etc/init.d/mysqld start     ----------启动服务
[root@slave mysql]# ./bin/mysql                  ----------进入数据库