www.colben.cn/content/post/mysql5.7-install.md
2021-11-14 14:32:08 +08:00

984 B

title, date, lastmod, tags, categories
title date lastmod tags categories
CentOS7 yum 安装 Mysql5.7 2019-10-30T13:00:28+08:00 2019-10-30T13:00:28+08:00
centos
yum
mysql
database

环境

  • CentOS 7.4 x86_64 最小安装
  • MySQL 5.7.20

下载 mysql 源安装包

#repo 地址: https://repo.mysql.com/
cd /root/
curl -O https://repo.mysql.com/mysql57-community-release-el7.rpm

安装 mysql 源

rpm -ivh /root/mysql57-community-release-el7.rpm

更新 yum 缓存

yum clean all
yum makecache fast

安装 mysql

yum install mysql-community-server

启动 mysql

systemctl start mysqld

查找 mysql 默认密码

grep 'temporary password' /var/log/mysqld.log
mysql -uroot -p
# 输入查找到的密码

修改 mysql 本地密码

  • 在 mysql 下修改
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Pass-1234';
  • 或者直接在终端修改
mysqladmin -uroot -p password 'Pass-1234'