MySQL依赖libaio库,先用yum安装一下
(1)下载二进制包
cd /opt/
wget -c http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz
(2)解压到/opt/mysql下
mkdir /opt/mysql
tar xf mysql-5.7.14-linux-glibc2.5-x86_64 -C /opt/mysql/
(3)创建软链接
ln -s /opt/mysql/mysql-5.7.14-linux-glibc2.5-x86_64 /usr/local/mysql
(4)创建用户
groupadd mysql
useradd -M -g mysql -s /sbin/nologin -d /usr/local/mysql mysql
(5)创建基本目录
mkdir /data/mysql/mysql3306/{data,logs,tmp} -p
chown mysql.mysql /data/mysql/mysql3306/ -R
(6)初始化
./bin/mysqld --initialize
(7)创建启动脚本
cp support-files/mysql.server /etc/init.d/mysqld
(8)启动关闭
/etc/init.d/mysqld {start|stop|restart}
(9)添加环境变量
echo 'export PATH=$PATH:/usr/local/mysql/bin' > /etc/profile.d/mysql.sh
source /etc/profile
(10)改密码
mysql -S /tmp/mysql.sock -uroot -p
root@localhost [(none)]>alter user current_user() identified by '';