wget https://dev.mysql.com/get/mysql80-community-release-el7-1.noarch.rpm
#安装yum源
yum localinstall mysql80-community-release-el7-1.noarch.rpm
#更新yum源
yum clean all
yum makecache
#开始安装MySQL
yum install
mysql-community-server
#启动MySQL
systemctl start mysqld
#启动成功后可以查看初始化密码随机生成的
cat
/var/log/mysqld.log | grep
password
#登录MySQL修改mysql用户密码
mysql -u root -p
mysql> ALTER USER 'root'@'localhost'
IDENTIFIED BY 'yourpassword';
#远程设置
mysql> use mysql;
mysql> update user set
host='%'
where user='root';
#授权用户名的权限,赋予任何主机访问数据的权限
mysql> GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;
mysql> FLUSH PRIVILEGES;