1.安装环境
系统:centos7
mysql版本:5.7
安装方式:rpm安装
2.开始
- 下载
wget https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar
- 解压
mkdir mysql5.7
tar -xv -f mysql-5.7.26-1.el7.x86_64.rpm-bundle.tar -C mysql5.7
- 依次安装依赖
cd mysql5.7
rpm -ivh mysql-community-common-5.7.26-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-libs-5.7.26-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-client-5.7.26-1.el7.x86_64.rpm --nodeps --force
rpm -ivh mysql-community-server-5.7.26-1.el7.x86_64.rpm --nodeps --force
- 修改密码
修改配置文件,免密登录
vim /etc/my.cnf
添加一句:
skip-grant-tables
启动服务:
service mysqld restart
进入数据库:
mysql
修改密码:
use mysql;
UPDATE user SET authentication_string = password('你要填写的密码') WHERE host = 'localhost' AND user = 'root';
去掉之前的配置
vim /etc/my.cnf
#skip-grant-tables
- 重启进入
service mysqld restart
mysql -uroot -p