当前位置:   article > 正文

MySQL之环境搭建(一)_yum-config-manager --disable mysql80-community

yum-config-manager --disable mysql80-community

添加MySQL的Yum仓库

  1. 下载rpm文件
    rpm文件下载地址

rpm

可以通过wget命令下载:

sudo wget https://dev.mysql.com/get/mysql80-community-release-el7-5.noarch.rpm
  • 1

wget下载2. 安装Yum文件

sudo yum localinstall mysql80-community-release-el7-5.noarch.rpm
  • 1

rpm安装3. 检测是否成功添加Yum仓库

sudo yum repolist enabled | grep "mysql.*-community.*"
  • 1

yum

选择MySQL版本

  1. 查看版本列表
sudo yum repolist all | grep mysql
  • 1

yum

  1. 选择MySQL5.7
sudo yum-config-manager --disable mysql80-community
sudo yum-config-manager --enable mysql57-community
  • 1
  • 2

查看结果yum repolist all | grep mysql
yum

禁用默认的MySQL模块(针对centos8)

sudo yum module disable mysql
  • 1

安装MySQL

sudo yum install mysql-community-server
  • 1

在这里插入图片描述

启动MySQL

sudo service mysqld start # 老版
sudo systemctl start mysqld
  • 1
  • 2

检查启动情况

systemctl status mysqld #或者
systemctl status mysqld.service
  • 1
  • 2

mysql

获取MySQL初始化的密码

sudo grep 'temporary password' /var/log/mysqld.log
  • 1

mysql

使用密码登录

mysql -uroot -p 
# 然后输入刚才查询的密码
  • 1
  • 2

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY '新密码!';
  • 1

在这里插入图片描述
官方说明密码设置要求

validate_password is installed by default. The default password policy implemented by validate_password requires that passwords contain at least one uppercase letter, one lowercase letter, one digit, and one special character, and that the total password length is at least 8 characters

待续

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/菜鸟追梦旅行/article/detail/181025
推荐阅读
相关标签
  

闽ICP备14008679号