yum -y install libaio libaio-devel
[root@bogon ~]# groupadd mysql
[root@bogon ~]# useradd -r -g mysql -s /bin/false mysql
tar -xf mysql-5.7.25-el7-x86_64.tar.gz -C /usr/local/mysql
mv mysql-5.7.25-el7-x86_64/ mysql
ln -s /usr/local/mysql/bin/* /usr/local/bin
chown -R mysql:mysql /usr/local/mysql/
[root@bogon mysql]# mkdir mysql-files
[root@bogon mysql]# chown mysql:mysql mysql-files
[root@bogon mysql]# chmod 750 mysql-files
[root@bogon support-files]# vim /etc/my.cnf
[mysqld]
datadir=/usr/local/mysql/data
character-set-server = utf8
socket=/tmp/mysql.sock
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid
chown -R mysql:mysql /var/run/mysqld
mysqld --initialize --user=mysql
#初始化后会生成原始密码,如果需要可以指定默认配置文件--defaults-file=/etc/my.cnf
cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld
/etc/init.d/mysqld start
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'gGrD+JCYL0jq';