1.上传并转移安装包
sudo cp /soft/mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz /usr/local/
2.进入安装包所在目录
cd /usr/local/
3.解压安装包
sudo tar -zxvf mysql-5.7.9-linux-glibc2.5-x86_64.tar.gz
4.查看安装文档说明
cd mysql-5.7.9-linux-glibc2.5-x86_64
vi INSTALL-BINARY
5.新增mysql组
sudo groupadd mysql
6.新增mysql用户
sudo useradd -r -g mysql mysql
7.创建软链
sudo ln -s /usr/local/mysql-5.7.9-linux-glibc2.5-x86_64 mysql
8.创建mysql文件夹并赋权
sudo mkdir mysql-files
sudo chmod 770 mysql-files
sudo chgrp -R mysql .
sudo chown -R mysql .
9.生成密钥
sudo bin/mysqld --initialize --user=mysql
2WRds1RT>_bt
sudo bin/mysql_ssl_rsa_setup
sudo chown -R root .
sudo chown -R mysql data mysql-files
sudo mkdir data
sudo bin/mysqld_safe --user=mysql &
10.修改默认配置文件
cd /etc
sudo my.cnf my.cnfbak
11.重新初始化
bin/mysqld --initialize --user=mysql
fovdq63W&fCd
sudo chown -R root .
sudo chown -R mysql data mysql-files
sudo bin/mysqld_safe --user=mysql &
12.设值默认开启
sudo cp support-files/mysql.server /etc/init.d/mysql.server
chkconfig --list
sudo chkconfig mysql server on
chkconfig --list
13.配置环境变量
sudo vi /etc/profile
source /etc/profile
14.尝试登录
mysql -uroot -p
set password =‘zlm222333‘;
15.修改密码以及远程登录
GRANT ALL PRIVILEGES ON . TO ‘root‘@‘%‘ IDENTIFIED BY ‘zlm222333‘
GRANT ALL PRIVILEGES ON . TO ‘root‘@‘%‘ IDENTIFIED BY ‘root1234%‘ WITH GRANT OPTION;
flush privileges;
16.修改防火墙设值
firewall-cmd --query-port=3306/tcp
firewall-cmd --zone=public --add-port=3306/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-port
17,效果图