Linux 在线安装MySQL8.0
1、更新Linux yum
yum update
2、安装wget工具(如果已经安装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、查看生成的临时密码
grep 'temporary password' /var/log/mysqld.log
输出结果末尾即为初始化生成的临时密码。
7、登录MySQL,并修改密码。
mysql -hlocalhost -uroot -p临时密码
此时如果不修改密码,直接访问数据库,会报如下错误:
修改root密码
ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '新密码';
注:
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
本文来自博客园,作者:业余砖家,转载请注明原文链接:https://www.cnblogs.com/yeyuzhuanjia/p/16227569.html