yum安装mysql5.7散记

## 数据源安装
$ yum -y install wget
$ wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm
$ yum localinstall mysql57-community-release-el7-8.noarch.rpm 
$ yum repolist enabled | grep "mysql.*-community.*"
$ yum install mysql-community-server

## 设置启动项
$ systemctl enable mysqld
$ systemctl start mysqld
$ systemctl daemon-reload

## 开放端口
$ firewall-cmd --zone=public --add-port=3306/tcp --permanent
$ firewall-cmd --reload

## 账号设置
$ grep 'temporary password' /var/log/mysqld.log
$ mysql -uroot -p
mysql> alter user 'root'@'localhost' identified by 'TieZhu@1234';
mysql> show variables like '%password%';
mysql> grant all privileges on *.* to 'tiezhu'@'%' identified by 'TieZhu@1234' with grant option;

## 忘记root密码
## 配置文件添加:skip-grant-tables
## 修改完密码配置文件还原
$ vi /etc/my.cnf
$ service mysqld restart

## 卸载数据库
$ rpm -qa | grep -i mysql
$ yum remove mysql-xxx
$ find / -name mysql
$ rm -rf /abc/cba/xxx

安装提示:Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
解决办法:rpm --import https://repo.mysql.com/RPM-GPG-KEY-mysql-2022

如图:

在这里插入图片描述

你可能感兴趣的:(mysql)