Centos7安装mysql8
2021/9/7 19:07:43
本文主要是介绍Centos7安装mysql8,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!
安装mysql
# 从国内镜像下载mysql8 wget https://mirrors.tuna.tsinghua.edu.cn/mysql/yum/mysql80-community-el7/mysql80-community-release-el7-3.noarch.rpm # 安装 yum install mysql80-community-release-el7-3.noarch.rpm # 下载完成后,yum安装 yum install mysql-server # 查看是否开机启动 systemctl list-unit-files|grep mysql #mysqld.service enabled 开机启动 #mysqld@.service disabled # 如果不是开机启动,设置开机启动 systemctl enable mysqld.service #启动mysql systemctl start mysqld.service # 初始化mysql mysqld --initialize # 查看初始化root密码 grep 'temporary password' /var/log/mysqld.log #[root@localhost hao]# grep 'temporary password' /var/log/mysqld.log #2021-09-06T09:14:23.235555Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 8JmeNwgQd-DZ # 登录 mysql -u root -p # 出现下面提示后输入上面密码:8JmeNwgQd-DZ Enter password:
配置mysql
# 修改初始化密码 alter user 'root'@'localhost' identified by '这里输入新密码'; # 如果搭建测试环境,可以修改密码策略,设置简易密码 # 查看密码策略 show variables like 'validate_password%'; # 设置密码复杂度为低 set global validate_password.policy=0; #设置密码长度 set global validate_password.length=1; # 创建新用户,这里如果执行create user 'user01'@'localhost' identified by '123456'; 只允许本地访问 create user 'user01'@'%' identified by '123456'; # 用户授权 grant all on *.* to 'user01'@'%';
现在可以用用户user01远程连接数据库,远程连接一定要设置serverTimeZone=Asia/Shanghai
这篇关于Centos7安装mysql8的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!
- 2024-12-25如何部署MySQL集群资料:新手入门教程
- 2024-12-24MySQL集群部署资料:新手入门教程
- 2024-12-24MySQL集群资料详解:新手入门教程
- 2024-12-24MySQL集群部署入门教程
- 2024-12-24部署MySQL集群学习:新手入门教程
- 2024-12-24部署MySQL集群入门:一步一步搭建指南
- 2024-12-07MySQL读写分离入门:轻松掌握数据库读写分离技术
- 2024-12-07MySQL读写分离入门教程
- 2024-12-07MySQL分库分表入门详解
- 2024-12-07MySQL分库分表入门指南