CentOS7离线安装MySQL8.0

Posted ZeroTeam_麒麟

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了CentOS7离线安装MySQL8.0相关的知识,希望对你有一定的参考价值。

下载tar包 https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar

yum install -y lrzsz

在/usr/local目录下新建目录mysql
cd /usr/local
mkdir mysql

在/usr/local/mysql目录下使用rz -be命令上传mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar

tar -xvf mysql-8.0.15-1.el7.x86_64.rpm-bundle.tar
得到文件如图:

rpm -qa | grep mariadb 命令查看 mariadb 的安装包

rpm -e mariadb-libs-5.5.60-1.el7_5.x86_64 --nodeps 卸载mariadb

再次执行6查看

rpm -ivh mysql-community-common-8.0.15-1.el7.x86_64.rpm --nodeps --force 命令安装 common

依次: libs,client,server

rpm -qa | grep mysql

初始化
mysqld --initialize;
[root@1234 mysql]# mysqld --initialize;
mysqld: error while loading shared libraries: libaio.so.1: cannot open shared object file: No such file or directory
yum install -y libaio安装依赖

mysqld --initialize;
chown mysql:mysql /var/lib/mysql -R;
systemctl start mysqld;

cat /var/log/mysqld.log | grep password查看密码

登录后修改密码:
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘root’;

远程访问

修改密码
ALTER USER ‘root’@‘localhost’ IDENTIFIED WITH mysql_native_password BY ‘Mi7’;

7.删除 my.cnf skip-grant-tables

8.重启登陆
FLUSH PRIVILEGES;

9.开启远程连接

use mysql;

update user set host = ‘%’ where user = ‘root’;

ALTER USER ‘root’@’%’ IDENTIFIED BY ‘Mi7E’ PASSWORD EXPIRE NEVER;

FLUSH PRIVILEGES;

以上是关于CentOS7离线安装MySQL8.0的主要内容,如果未能解决你的问题,请参考以下文章

Arm架构下CentOS7.6操作系统网络离线状态下安装MySQL8

CentOS 7.9 安装MySQL 8.0.26 Community社区版

Centos7 安装mysql-8.0.13(rpm)

centos7安装mysql8.0

Centos7 安装Mysql8.0

CentOS7使用yum安装MySQL8.0