centos 7 安装 MySql8

安装步骤

  1. yum仓库下载MySQL(这个链接的版本为8.0.16)
    yum localinstall https://repo.mysql.com//mysql80-community-release-el7-3.noarch.rpm
  2. yum安装MySQL
    yum install mysql-community-server
  3. 启动MySQL服务
    service mysqld start
  4. 检查MySQL服务状态
    service mysqld status
  5. 查看初始密码(如无内容直接跳过)
    grep 'temporary password' /var/log/mysqld.log
  6. 登陆mysql(输入密码为第5步查出的)
    mysql -uroot -p
  7. 修改root密码:
    ALTER USER 'root'@'localhost' IDENTIFIED BY '密码';
  8. 配置远程连接
  • 先创建用户(我这里为dev用户,名字可随便取)
    create user 'dev'@'%' identified by '密码';
  • 授权用户
    grant all privileges on *.* to 'dev'@'%' with grant option;
  • 修改加密规则
    ALTER USER 'dev'@'%' IDENTIFIED WITH mysql_native_password BY '密码.';
  1. 测试连接


注意:

  • 中间有选择y/n选项,选y,回车,比如
    Is this ok [y/d/N]: y

你可能感兴趣的:(centos 7 安装 MySql8)