基于Linux环境下的MySQL8.0版本的本地下载安装详细步骤

发布时间:2024年01月14日

本地下载安装

在这里插入图片描述
MySQL_RPM捆绑包

1.安装压缩包

[root@192 ~]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar
--2024-01-13 22:21:04--  https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar
正在解析主机 cdn.mysql.com (cdn.mysql.com)... 223.119.141.101, 2402:4f00:4002:190::1d68, 2402:4f00:4002:19d::1d68
正在连接 cdn.mysql.com (cdn.mysql.com)|223.119.141.101|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 200 OK
长度:859688960 (820M) [application/x-tar]
正在保存至: “mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar.1”

mysql-8.0.35-1.el9.x86_64.rpm-bundle.t 100%[============================================================================>] 819.86M  35.5MB/s  用时 29s     

2024-01-13 22:21:33 (28.7 MB/s) - 已保存 “mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar.1” [859688960/859688960])

2.在"/''目录下创建MySQL目录将下载好的压缩包移动到"/mysql"目录中对其进行解压

[root@192 ~]# mkdir /mysql
[root@192 ~]# mv mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar /mysql
[root@192 ~]# cd /mysql
[root@192 mysql]# ll
总用量 718004
-rw-r--r--. 1 root root 735232478  113 22:20 mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar

[root@192 mysql]# tar xvf mysql-8.0.35-1.el9.x86_64.rpm-bundle.tar 
mysql-community-client-8.0.35-1.el9.x86_64.rpm
mysql-community-client-debuginfo-8.0.35-1.el9.x86_64.rpm
mysql-community-client-plugins-8.0.35-1.el9.x86_64.rpm
mysql-community-client-plugins-debuginfo-8.0.35-1.el9.x86_64.rpm
mysql-community-common-8.0.35-1.el9.x86_64.rpm
mysql-community-debuginfo-8.0.35-1.el9.x86_64.rpm
mysql-community-debugsource-8.0.35-1.el9.x86_64.rpm
mysql-community-devel-8.0.35-1.el9.x86_64.rpm
mysql-community-icu-data-files-8.0.35-1.el9.x86_64.rpm
mysql-community-libs-8.0.35-1.el9.x86_64.rpm
mysql-community-libs-debuginfo-8.0.35-1.el9.x86_64.rpm
mysql-community-server-8.0.35-1.el9.x86_64.rpm
mysql-community-server-debug-8.0.35-1.el9.x86_64.rpm
mysql-community-server-debug-debuginfo-8.0.35-1.el9.x86_64.rpm
mysql-community-server-debuginfo-8.0.35-1.el9.x86_64.rpm
mysql-community-test-8.0.35-1.el9.x86_64.rpm
[root@192 mysql]#  

3.安装软件包

[root@192 mysql]# dnf localinstall mysql-community-server-8.0.35-1.el9.x86_64.rpm mysql-community-client-8.0.35-1.el9.x86_64.rpm mysql-community-common-8.0.35-1.el9.x86_64.rpm mysql-community-icu-data-files-8.0.35-1.el9.x86_64.rpm mysql-community-client-plugins-8.0.35-1.el9.x86_64.rpm mysql-community-libs-8.0.35-1.el9.x86_64.rpm 
正在更新 Subscription Management 软件仓库。
无法读取客户身份

本系统尚未在权利服务器中注册。可使用 subscription-manager 进行注册。

CentOS-9-stream - Base - mirrors.aliyun.com                                                                                 3.3 MB/s | 7.9 MB     00:02    
CentOS-9-stream - AppStream - mirrors.aliyun.com                                                                            3.1 MB/s |  18 MB     00:05    
上次元数据过期检查:0:00:01 前,执行于 2024年01月13日 星期六 22时38分34秒。
依赖关系解决。
============================================================================================================================================================
 软件包                                              架构                        版本                               仓库                               大小
============================================================================================================================================================
安装:
 mysql-community-client                              x86_64                      8.0.35-1.el9                       @commandline                      3.5 M
 mysql-community-client-plugins                      x86_64                      8.0.35-1.el9                       @commandline                      1.4 M
 mysql-community-common                              x86_64                      8.0.35-1.el9                       @commandline                      557 k
 mysql-community-icu-data-files                      x86_64                      8.0.35-1.el9                       @commandline                      2.3 M
 mysql-community-libs                                x86_64                      8.0.35-1.el9                       @commandline                      1.4 M
 mysql-community-server                              x86_64                      8.0.35-1.el9                       @commandline                       49 M

事务概要
============================================================================================================================================================
安装  6 软件包

总计:58 M
安装大小:334 M
确定吗?[y/N]: y

4.安装完毕启动mysql,会生成随机密码在"/var/log/mysqld.log "下,将随机密码复制然后输入

[root@192 mysql]# systemctl start mysqld
[root@192 mysql]# mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@192 mysql]# grep password /var/log/mysqld.log 
2024-01-13T14:41:18.629566Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: <da01yybd;0K

5.登陆MySQL,修改用户密码

[root@192 ~]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 8.0.35

Copyright (c) 2000, 2023, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> show databases;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

mysql> alter user 'username'@'localhost' identified by '#Yk123456';	# 修改用户密码
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> alter user 'root'@'localhost' identified by '#Yk123456';
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.01 sec)
文章来源:https://blog.csdn.net/m0_62900249/article/details/135577049
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。