1、下载yum源的安装包
yum install https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
2、安装
yum install mysql-community-server
3、启动服务
systemctl start mysqld
4、查看状态
systemctl status mysqld
5、查看初始密码
grep 'temporary password' /var/log/mysqld.log
6、登录
mysql -uroot -p
7、更改密码
密码最好组合数字,大小写字母,特殊符号。修改好后退出。
alter user 'root'@'localhost' identified by 'xxxxx';
通过新密码再次登陆验证密码是否修改成功。
mysql -uroot -p
8、创建远程访问用户,依次执行下列命令
create user 'root'@'%' identified with mysql_native_password by 'xxxxx';
grant all privileges on *.* to 'root'@'%' with grant option;
flush privileges;