Linux - 安装MySQL
下载地址:https://downloads.mysql.com/archives/community/
安装步骤:
mkdir mysql
tar -xvf mysql-8.0.26-1.el7.x86_64.rpm-bundle.tar -C mysql
rpm -ivh mysql-community-common-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
# 报错:
警告:mysql-community-libs-8.0.26-1.el7.x86_64.rpm: 头V3 DSA/SHA256 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
mariadb-libs 被 mysql-community-libs-8.0.26-1.el7.x86_64 取代
# 解决
yum remove mysql-libs
rpm -ivh mysql-community-libs-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-libs-compat-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-devel-8.0.26-1.el7.x86_64.rpm
# 报错
警告:mysql-community-devel-8.0.26-1.el7.x86_64.rpm: 头V3 DSA/SHA256 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
pkgconfig(openssl) 被 mysql-community-devel-8.0.26-1.el7.x86_64 需要
# 解决
yum install openssl-devel
rpm -ivh mysql-community-devel-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-client-8.0.26-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
# 报错
警告:mysql-community-server-8.0.26-1.el7.x86_64.rpm: 头V3 DSA/SHA256 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
net-tools 被 mysql-community-server-8.0.26-1.el7.x86_64 需要
# 解决
yum install net-tools
rpm -ivh mysql-community-server-8.0.26-1.el7.x86_64.rpm
启动服务:
systemctl start mysqld
systemctl restart mysqld
systemctl stop mysqld
查看临时密码:
grep 'temporary password' /var/log/mysqld.log
登录后修改临时密码:
# 修改密码校验规则,否则修改不能修改为简单的密码
set global validate_password.policy = 0;
set global validate_password.length = 4;
# 修改密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
本文来自博客园,作者:chuangzhou,转载请注明原文链接:https://www.cnblogs.com/czzz/p/17747561.html