背景介绍:

系统 rockey linux 9.4

mysql 8.4.0

我一开始想在系统上安装5.7的着,因为我有这个包,但是通过rpm安装的时候,到最后一步提示我没有/usbin/chkconfig 这个目录,怀疑是系统的问题,然后想安装chkconfig,最后也没弄上,没办法了,升级mysql吧,去官网下载最新版本了,最后安装成功。

1.下载mysql

下载地址:MySQL :: MySQL Community Downloads

rockey linux rpm安装mysql 8.4.0-LMLPHP

rockey linux rpm安装mysql 8.4.0-LMLPHP

2.安装

将下载好的mysql上传到服务,并解压

rockey linux rpm安装mysql 8.4.0-LMLPHP

执行rpm安装命令:

按照下面的顺序执行,因为包会互相依赖

rpm -ivh mysql-community-common-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-client-plugins-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-libs-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-client-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-icu-data-files-8.4.0-1.el9.x86_64.rpm
rpm -ivh mysql-community-server-8.4.0-1.el9.x86_64.rpm

执行启动命令:

systemctl start mysqld

systemctl status mysqld

rockey linux rpm安装mysql 8.4.0-LMLPHP

3.修改密码,修改连接权限

grep 'temporary password' /var/log/mysqld.log

rockey linux rpm安装mysql 8.4.0-LMLPHP

3.1执行登录命令:

mysql -uroot -p

输入日志中的密码

3.2执行修改密码的sql语句

//必须符合数据库的密码要求
alter user root@localhost identified by ‘Ldy_2024';

3.3修改root的链接权限

use mysql;

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

flush privileges;

4.利用navicat连接

rockey linux rpm安装mysql 8.4.0-LMLPHP

07-14 04:03