1、更新Linux yum
yum update
2、安装wget工具(有可滤过该步骤)
yum install wget
3、使用wget下载MySQL Yum Repository并执行安装
wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
rpm -ivh mysql80-community-release-el7-5.noarch.rpm
4、在线安装MySQL8
yum install -y mysql-server
5、启动mysql服务
systemctl start mysqld
6、使用生成的临时密码登陆mysql,修改密码
临时密码在
grep 'temporary password' /var/log/mysqld.log
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '输入root帐户密码';
注:
mysql_native_password:采用原生MySQL加密策略,避免第三方工具不支持
修改密码若出现:ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
换第二套思路
mysql> use mysql;
mysql> update user set authentication_string=password('密码') where user='root' and host='localhost';
mysql> flush privileges;
注:MySQL8及以上password字段为authentication_string,不再是password