RPM包安装mysql8.0.23

 

1、下载压缩包

地址:https://dev.mysql.com/downloads/mysql/

一定要选择跟自己服务器对应的rpm包

通过命令uname –a 查看Linux系统是x86还是ARM架构

 

 

2、安装依赖包

yum install -y perl openssl openssl-devel libaio perl-JSON autoconf

3、解压并安装

tar -xvf mysql-8.0.23-1.el7.aarch64.rpm-bundle.tar

 

yum remove -y mariadb-libs

用命令去安装rpm包,因为各rpm包的安装是有依赖关系的,根据这个顺序进行安装:common-àclient-plugins--àlibs-àclient-àserveràdevel

rpm  -ivh mysql-community-common-8.0.23-1.el7.aarch64

 

4、修改配置文件

Vim /etc/my.cnf

增加下面几项:

skip-grant-tables

log_bin_trust_function_creators=1

lower_case_table_names=1

sql_mode=STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION

[client]

port=3306

default-character-set=utf8

 

5、启动mysql

systemctl start mysqld-----------启动服务

systemctl status mysqld---------查看状态

systemctl stop  mysqld----------停止服务

 

6、登录数据库

Mysql –uroot –p

直接回车进入,因为在my.cnf配置文件中有设置skip-grant-tables,意思是跳过权限验证,所以可以直接进入。

7、修改密码

在执行修改密码语句的时候报错,说设置的密码不符合密码规则,因为mysql有设置密码强度规则,想要设置简单的密码可以对规则进行修改。

首先查看对应的规则

SHOW CARIABLES LIKE ‘validate_password’;

 

将密码长度设置为4

set global validate_password.length=4;

将密码强度设置为LOW(0)

set global validate_password.policy=0;

flush privileges;

 

修改规则后再去修改密码

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'xmgps';

flush privileges;

 

设置好密码后需要将配置文件中的skip-grant-tables删除,然后再重启mysql服务

8、设置开启远程连接

Mysql  –uroot  –p

Use mysql

update user set user.Host='%' where user.User='root';

flush privileges;

exit

原文地址:https://www.cnblogs.com/shu-hua/p/14465233.html