mysql_8 yum安装教程
2021/6/10 19:22:15
本文主要是介绍mysql_8 yum安装教程,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
安装MySQL8.0资源库
yum localinstall https://repo.mysql.com//mysql80-community-release-el7-1.noarch.rpm
安装MySQL8.0
yum install mysql-community-server
启动MySQL并配置开机自启
systemctl start mysqld systemctl enable mysqld
查看默认密码并重置
查看密码
grep 'temporary password' /var/log/mysqld.log
登录并重置密码
mysql -pt&ki3u&+ib7X mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; ERROR 1819 (HY000): Your password does not satisfy the current policy requirements
这个与validate_password_policy的值有关, mysql8.0更改了validate_password_policy相关的配置, 这跟Mysql5.7有点不一样
修改密码校验规则与密码长度
mysql> set global validate_password.policy=0; Query OK, 0 rows affected (0.00 sec) mysql> set global validate_password.length=1; Query OK, 0 rows affected (0.00 sec)
继续修改密码
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '123456'; Query OK, 0 rows affected (0.03 sec)
退出后重新登录
使用MySQL8.0踩的坑
授权方式改变
mysql5.7
mysql> grant all privileges on *.* to 'kevin'@'%' ;
mysql8.0
mysql> grant all privileges on *.* to 'kevin'@'%' with grant option;
无法远程连接
MySQL8.0默认是不能使用root账户远程登录的
修改为可以远程登录
mysql> update mysql.user set host='%' where user="root"; mysql> flush privileges;
加密规则的改变
mysql8 之前的版本中加密规则是mysql_native_password, 而在mysql8之后,加密规则是caching_sha2_password
使用navicat进行mysql登录时出现弹窗报错
修改方式一是:升级navicat驱动,二是:把MySQL用户登录密码加密规则还原成mysql_native_password
#修改加密规则 mysql> ALTER USER 'root'@'%' IDENTIFIED BY '123456' PASSWORD EXPIRE NEVER; Query OK, 0 rows affected (0.16 sec) #更新一下用户的密码 mysql> ALTER USER 'root'@'%' IDENTIFIED WITH mysql_native_password BY '123456'; Query OK, 0 rows affected (0.08 sec) #刷新权限 mysql> FLUSH PRIVILEGES; Query OK, 0 rows affected (0.03 sec)
update修改密码,密码字段名称更改
mysql>update user set authentication_string=password("root") where user='root' and host='localhost';
这篇关于mysql_8 yum安装教程的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-11-04部署MySQL集群项目实战:新手入门教程
- 2024-11-04如何部署MySQL集群资料:新手入门指南
- 2024-11-02MySQL集群项目实战:新手入门指南
- 2024-11-02初学者指南:部署MySQL集群资料
- 2024-11-01部署MySQL集群教程:新手入门指南
- 2024-11-01如何部署MySQL集群:新手入门教程
- 2024-11-01部署MySQL集群学习:新手入门教程
- 2024-11-01部署MySQL集群入门:新手必读指南
- 2024-10-23BinLog入门:新手必读的MySQL二进制日志指南
- 2024-10-23Binlog入门:MySQL数据库的日志管理指南