1,输入:
wget https://dev.mysql.com/get/mysql80-community-release-el8-1.noarch.rpm
2、安装数据源
然后输入:yum install mysql80-community-release-el8-1.noarch.rpm
3.
查看mysql源是否安装成功:yum repolist enabled | grep "mysql.*-community.*"
4.禁用CentOS8自带的mysql模块
yum module disable mysql
5.真正安装mysql
yum install mysql-community-server
6.启动mysql
输入:
service mysqld start
service mysqld status
7.显示mysql的随机密码
输入:grep 'temporary password' /var/log/mysqld.log
8.登录并修改mysql密码
登录:mysql -u root -p
然后输入上面生成的密码
9.修改密码
修改密码:ALTER USER 'root'@'localhost' IDENTIFIED BY 'Root_21root';
查看密码策略:SHOW VARIABLES LIKE 'validate_password%';
修改密码长度:set global validate_password.length=1;(长度) 修改密码等级:set global validate_password.policy=0;(等级)
10.设置自己想要的密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
11.Mysql8.0.22开放远程访问
真确写法: 1、先创建权限记录:create user 'root'@'%' identified by 'root123'; 2、授权:grant all privileges on *.* to 'root'@'%' with grant option; 两句话分开写:
12.开放防火墙端口
.....
13.
sqlyog连接的坑
本地去连接mysql时报错,错误 2058 Plugin caching_sha2_password could not be loaded
由于mysql8.0的加密方法变了。mysql8.0默认采用caching_sha2_password的加密方式。sqlyog不支持这种加密方式。
1、修改密码过期 ALTER USER'root'@'localhost' IDENTIFIED BY 'root' PASSWORD EXPIRE NEVER; 2、重新修改密码 ALTER USER'root'@'%' IDENTIFIED WITH mysql_native_password BY 'root'; 3、刷新权限(不做可能无法生效) FLUSH PRIVILEGES;