tar -zxvf Percona-Server-5.1.55-rel12.6-200-Linux-x86_64.tar.gz -C /usr/local/
mv /var/webserver/Percona-Server-5.1.55-rel12.6-200-Linux-x86_64 /usr/local/mysql //改文件名
(2)echo “/usr/local/mysql/lib” >> /etc/ld.so.conf.d/libc.conf
echo “/usr/local/mysql/lib/mysql” >> /etc/ld.so.conf.d/libc.conf
/sbin/ldconfig
mkdir /usr/local/mysql/data //新建数据库数据目录
(3)添加用户和组
groupadd mysql
useradd -g mysql mysql
(4)配置文件
cp /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf //生成my.cnf文件
使用脚本修改my.cnf 行数试具体版本情况而定
sed -i ’25 a\basedir = /var/webserver/mysql’ /etc/my.cnf //指定基本目录
sed -i ’26 a\datadir = /var/webserver/mysql/data’ /etc/my.cnf //指定数据存放目录
sed -i ’27 a\max_connections = 1000′ /etc/my.cnf //最大连接数,这里最大可以为100000
sed -i ’28 a\skip-name-resolve’ /etc/my.cnf //关闭DNS解析
sed -i ’29 a\pid-file=/var/webserver/run/mysql.pid’ /etc/my.cnf //指定PID文件
sed -i ’30 a\default-storage-engine = innodb’ /etc/my.cnf //指定默认引擎,可以通过show engines;来查看
sed -i ’31 a\log-error = /var/webserver/logs/mysql.err’ /etc/my.cnf //指定错误文件
sed -i “s/skip-locking/skip-external-locking/g” /etc/my.cnf //关闭外部锁
(5)改属主和属组
chown -R mysql:mysql /usr/local/mysql/ //将basedir的用户和组改为mysql
(6)初使化数据表
#/usr/local/mysql/bin/mysql_install_db -–user=mysql -–basedir=/usr/local/mysql -–datadir=/usr/local/mysql/data
[root@test local]# /usr/local/mysql/bin/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/data
Installing MySQL system tables...
110406 15:54:47 [Note] Flashcache bypass: disabled
110406 15:54:47 [Note] Flashcache setup error is : ioctl failed
OK
Filling help tables...
110406 15:54:49 [Note] Flashcache bypass: disabled
110406 15:54:49 [Note] Flashcache setup error is : ioctl failed
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:
/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h 123.196.116.19 password 'new-password'
Alternatively you can run:
/usr/local/mysql/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 /usr/local/mysql ; /usr/local/mysql/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/local/mysql/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/local/mysql/scripts/mysqlbug script!
For commercial support please contact Percona at http://www.percona.com/contacts.html
(7)设置mysql启动脚本
[root@test init.d]# cp /usr/local/mysql/share/mysql/mysql.server /etc/init.d/rc.mysql
[root@test init.d]# chmod 755 /etc/init.d/rc.mysql
(8)启动mysql服务
[root@test ~]# /etc/init.d/rc.mysql start
Starting MySQL (Percona Server).Manager of pid-file quit without updating file.[FAILED]
解决办法:
#ps -ef | grep mysql 或 ps -A |grep mysql
杀掉多余的进程
脚本中有个建立
/usr/local/mysql/bin/mysql_install_db --user=mysql --初始数据库
重新运行一次
然后重启mysql ,一切OK
[root@kspc mysql-5.1.31]# /etc/init.d/mysqld restart
MySQL manager or server PID file could not be found! [FAILED]
Starting MySQL. [ OK ]
// 我日你妈..这个问题闷了我三天啊...我的假期啊.
(9)设置mysql登录密码
[root@test ~]# /usr/local/mysql/bin/mysqladmin -u root password 'xxxxxxxx'
修改
#mysql -u root -p 输入密码即可
(10)安装完成