对于一般用户而言喜欢编译安装或者yum安装,在本人工作中,一般都是用二进制快速安装,这里讲安装步骤记录如下:
1.下载二进制文件到目录/home/www/tools下
[[email protected] tools]# ll
total 102
-rw-r--r-- 1 root root 186722932 Apr 22 2015 mysql-5.5.32-linux2.6-x86_64.tar.gz
[[email protected] tools]#
2.创建/application目录和及其下面子目录/application/mysql、/application/mysql/data
[[email protected] tools]# mkdir -p /application/mysql/data
[[email protected] tools]# tree /application/
/application/
└── mysql
└── data
2 directories, 0 files
[[email protected] tools]#
3.安装mysql
ls mysql-5.5.32-linux2.6-x86_64.tar.gz
tar xf mysql-5.5.32-linux2.6-x86_64.tar.gz
mv mysql-5.5.32-linux2.6-x86_64 /application/mysql-5.5.32
ln -s /application/mysql-5.5.32 /application/mysql
##########相当于编译步骤的make install完成#############
4.创建用户和目录
useradd mysql -s /sbin/nologin -M
chown -R mysql.mysql /application/mysql/data/
5.初始化数据库
cd /application/mysql
./scripts/mysql_install_db --user=mysql --basedir=/application/mysql --datadir=/application/mysql/data/
\cp support-files/my-small.cnf /etc/my.cnf
cp support-files/mysql.server /etc/init.d/mysqld
chmod +x /etc/init.d/mysqld
sed -i ‘s#/usr/local/mysql#/application/mysql#g‘ /application/mysql/bin/mysqld_safe /etc/init.d/mysqld
/etc/init.d/mysqld start
netstat -lntup|grep mysql
cp -a /application/mysql/bin/* /usr/local/sbin/
mysqladmin password Tnt123
mysql -uroot -pTnt123