1、下载mysql5.7编译包
yum -y install wget
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.32-linux-glibc2.12-x86_64.tar.gz
tar xvf mysql*.tar.gz
mv mysql* /usr/local/mysql
mkdir /usr/local/mysql/data
2、设置环境变量
echo 'export PATH=$PATH:/usr/local/mysql/bin' >> /etc/profile && source /etc/profile
ln -s /usr/local/mysql/data/mysql.sock /tmp
3、创建用户,并授权
groupadd mysql && useradd -r -g mysql -s /bin/false mysql
chown -R mysql:mysql /usr/local/mysql && chmod 750 /usr/local/mysql
4、更改库参数配置
cat > /etc/my.cnf <<eof
[mysqld]
#skip_grant_tables #密码重置,跳过权限验证
#service
port = 3306 #监听端口号,mysqld默认监听3306,建议修改成其他端口号
socket=/usr/local/m