> yum install libaio -y
> wget http://mirrors.sohu.com/mysql/MySQL-5.7/mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz
> tar -xvf mysql-5.7.24-linux-glibc2.12-x86_64.tar.gz -C /usr/local/
> cd /usr/local
> ln -s mysql-5.7.24-linux-glibc2.12-x86_64 mysql
> useradd -M -s /sbin/nologin mysql -g mysql
-M
不创建家目录
> cd mysql
> chown -R mysql:mysql ./
>./bin/mysqld --user=mysql --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --initialize
将随机生成的登录密码记录下来:xxx
> vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
socket=/tmp/mysql.sock
[mysqld_safe]
log-error=/usr/local/mysql/data/mysql.log
pid-file=/usr/local/mysql/data/mysql.pid
> cp support-files/mysql.server /etc/init.d/mysqld
> service mysqld restart
> ./bin/mysqladmin -u root -p'xxx' password 'newxxx'
> ln -s /usr/local/mysql/bin/* /usr/local/bin/