安装mysql5.5二进制包
今天给大家讲下了怎么安装mysql二进制包,这样避免在自己测试环境中还要去编译安装,浪费大量的时间,好了,来看教程吧.
系统:centos 5.x
需要的软件包:mysql-5.5.33-linux2.6-i686.tar.gz
1.下载mysql二进制包
wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.33-linux2.6-i686.tar.gz
2.安装mysql
tar zxf mysql-5.5.33-linux2.6-i686.tar.gz
groupadd mysql
useradd -r -g mysql mysql
mv mysql-5.5.33-linux2.6-i686 /usr/local/mysql
cd /usr/local/mysql/scripts/
mkdir /var/lib/mysql
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql
如果报下面的错误:
/usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
那么就要执行下面的命令:
yum -y install libaio
然后再执行
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql
初始化成功后,执行
chown -R root.mysql /usr/local/mysql
chown -R mysql.mysql /var/lib/mysql
cd ../support-files/
cp mysql.server /etc/init.d/mysqld
cp my-medium.cnf /etc/my.cnf
chmod +x /etc/init.d/mysqld
sed -i "s:^datadir=.*:datadir=/var/lib/mysql:g" /etc/init.d/mysqld
service mysqld start
vi /etc/profile
在最后添加一句:
PATH=/usr/local/mysql/bin:$PATH
source /etc/profile
好了,到这里mysql安装就完成了.
系统:centos 5.x
需要的软件包:mysql-5.5.33-linux2.6-i686.tar.gz
1.下载mysql二进制包
wget http://cdn.mysql.com/Downloads/MySQL-5.5/mysql-5.5.33-linux2.6-i686.tar.gz
2.安装mysql
tar zxf mysql-5.5.33-linux2.6-i686.tar.gz
groupadd mysql
useradd -r -g mysql mysql
mv mysql-5.5.33-linux2.6-i686 /usr/local/mysql
cd /usr/local/mysql/scripts/
mkdir /var/lib/mysql
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql
如果报下面的错误:
/usr/local/mysql/bin/mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
那么就要执行下面的命令:
yum -y install libaio
然后再执行
./mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/lib/mysql
初始化成功后,执行
chown -R root.mysql /usr/local/mysql
chown -R mysql.mysql /var/lib/mysql
cd ../support-files/
cp mysql.server /etc/init.d/mysqld
cp my-medium.cnf /etc/my.cnf
chmod +x /etc/init.d/mysqld
sed -i "s:^datadir=.*:datadir=/var/lib/mysql:g" /etc/init.d/mysqld
service mysqld start
vi /etc/profile
在最后添加一句:
PATH=/usr/local/mysql/bin:$PATH
source /etc/profile
好了,到这里mysql安装就完成了.
评论: