Centos7离线安装MySQL8

1、下载MySQL

https://downloads.mysql.com/archives/community/

Centos7离线安装MySQL8_第1张图片

2、下载完毕后,上传到Centos,解压

tar -xf mysql-8.0.33-1.el7.x86_64.rpm-bundle.tar  

3、逐条执行安装命令

rpm -ivh mysql-community-common-8.0.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-8.0.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-client-8.0.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-client-plugins-8.0.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-icu-data-files-8.0.33-1.el7.x86_64.rpm 
rpm -ivh mysql-community-server-8.0.33-1.el7.x86_64.rpm 
mysqld --initialize --user=mysql
systemctl status mysqld
systemctl start mysqld
systemctl status mysqld

4、查看临时密码

cat /var/log/mysqld.log

 5、修改mysql的root密码

alter user 'root'@'localhost' identified by 'xxxxxx'

执行完后,重新登录MySQL 

quit

6、允许远程登录

mysql -uroot -p
use mysql;

select host from user where user='root';

update user set host = '%' where user ='root';

更新配置

flush privileges;

你可能感兴趣的:(MySQL,MySQL)