centos6 安装mysql5.5二进制包

今天安装一下二进制包的mysql,绿色版用起来清爽!

先根据系统版本下载相应的二进制包.
版本可能随时过期可以进入http://mirrors.sohu.com/mysql/MySQL-5.5/选择相应最新的包!

[root@i2 mysql]# uname -a
Linux f1.cc 2.6.32-504.el6.x86_64 #1 SMP Wed Oct 15 04:27:16 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
wget http://mirrors.sohu.com/mysql/MySQL-5.5/mysql-5.5.55-linux2.6-x86_64.tar.gz

解压放到相应的目录下面

tar -xzf mysql-5.5.55-linux2.6-x86_64.tar.gz
mv mysql-5.5.55-linux2.6-x86_64 /usr/local/mysql

建立数据文件夹并初化

useradd -s /sbin/nologin mysql
mkdir /data0/mysql
cd /data0
chown mysql:mysql mysql
cd /data0/mysql
mkdir data3360
/usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql/ --datadir=/data0/mysql/data3360/

建立配置文件

cp /usr/local/mysql/support-files/my-medium.cnf /data0/mysql/my3360.cnf
vim my3360.cnf

添加以下几行

[mysqld]
basedir         = /usr/local/mysql
datadir         = /data0/mysql/data3360
port            = 3360
socket          = /data0/mysql/3360.sock
log-error       = /data0/mysql/3360.err
pid-file        = /data0/mysql/3360.pid

创建启动关闭脚本

#mysql3360.start.sh
/usr/local/mysql/bin/mysqld_safe --defaults-file=/data0/mysql/my3360.cnf &

#mysql3360.stop.sh
kill `cat /data0/mysql/3360.pid`

添加相关文件变量

ln -s /usr/local/mysql/bin/mysql /usr/bin/
ln -s /usr/local/mysql/bin/mysqldump /usr/bin/
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib
ln -s /usr/local/mysql/lib/libmysqlclient.so.18 /lib64

报错及解决方法
error while loading shared libraries: libaio.so.1
解决:yum install libaio

Error: unable to create temporary file

over~

发表评论

电子邮件地址不会被公开。 必填项已用*标注

Captcha Code