MySQL四种安装方式

仓库安装

先在mysql官网上找到需要版本的域名然后用rpm安装下载下来

[root@bb~]# rpm -ivh https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm

获取https://repo.mysql.com//mysql80-community-release-el9-1.noarch.rpm

Verifying... ################################# [100%]

准备中... ################################# [100%]

正在升级/安装...

1:mysql80-community-release-el9-1 ################################# [100%]

# 然后安装mysql服务器

[root@bb ~]# dnf install mysql-server -y

正在更新 Subscription Management 软件仓库。

无法读取客户身份

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

上次元数据过期检查:1:04:32 前,执行于 Sat 11 Feb 2023 00:44:29 CST。

依赖关系解决。

========================================================================================================================

软件包 架构 版本 仓库 大小

========================================================================================================================

安装:

mysql-community-server x86_64 8.0.32-1.el9 mysql80-community 49 M

安装依赖关系:

mysql-community-client x86_64 8.0.32-1.el9 mysql80-community 3.9 M

mysql-community-client-plugins x86_64 8.0.32-1.el9 mysql80-community 1.4 M

mysql-community-common x86_64 8.0.32-1.el9 mysql80-community 544 k

mysql-community-icu-data-files x86_64 8.0.32-1.el9 mysql80-community 2.2 M

mysql-community-libs x86_64 8.0.32-1.el9 mysql80-community 1.5 M

事务概要

========================================================================================================================

安装 6 软件包

总下载:59 M

安装大小:335 M

下载软件包:

(1/6): mysql-community-common-8.0.32-1.el9.x86_64.rpm 368 kB/s | 544 kB 00:01

(2/6): mysql-community-client-plugins-8.0.32-1.el9.x86_64.rpm 844 kB/s | 1.4 MB 00:01

(3/6): mysql-community-client-8.0.32-1.el9.x86_64.rpm 1.9 MB/s | 3.9 MB 00:02

(4/6): mysql-community-icu-data-files-8.0.32-1.el9.x86_64.rpm 2.9 MB/s | 2.2 MB 00:00

(5/6): mysql-community-libs-8.0.32-1.el9.x86_64.rpm 1.6 MB/s | 1.5 MB 00:00

(6/6): mysql-community-server-8.0.32-1.el9.x86_64.rpm 7.4 MB/s | 49 MB 00:06

------------------------------------------------------------------------------------------------------------------------

总计 6.7 MB/s | 59 MB 00:08

运行事务检查

事务检查成功。

运行事务测试

事务测试成功。

运行事务

准备中 : 1/1

安装 : mysql-community-common-8.0.32-1.el9.x86_64 1/6

安装 : mysql-community-client-plugins-8.0.32-1.el9.x86_64 2/6

安装 : mysql-community-libs-8.0.32-1.el9.x86_64 3/6

运行脚本: mysql-community-libs-8.0.32-1.el9.x86_64 3/6

安装 : mysql-community-client-8.0.32-1.el9.x86_64 4/6

安装 : mysql-community-icu-data-files-8.0.32-1.el9.x86_64 5/6

运行脚本: mysql-community-server-8.0.32-1.el9.x86_64 6/6

安装 : mysql-community-server-8.0.32-1.el9.x86_64 6/6

运行脚本: mysql-community-server-8.0.32-1.el9.x86_64 6/6

验证 : mysql-community-client-8.0.32-1.el9.x86_64 1/6

验证 : mysql-community-client-plugins-8.0.32-1.el9.x86_64 2/6

验证 : mysql-community-common-8.0.32-1.el9.x86_64 3/6

验证 : mysql-community-icu-data-files-8.0.32-1.el9.x86_64 4/6

验证 : mysql-community-libs-8.0.32-1.el9.x86_64 5/6

验证 : mysql-community-server-8.0.32-1.el9.x86_64 6/6

已更新安装的产品。

已安装:

mysql-community-client-8.0.32-1.el9.x86_64 mysql-community-client-plugins-8.0.32-1.el9.x86_64

mysql-community-common-8.0.32-1.el9.x86_64 mysql-community-icu-data-files-8.0.32-1.el9.x86_64

mysql-community-libs-8.0.32-1.el9.x86_64 mysql-community-server-8.0.32-1.el9.x86_64

完毕!

[root@bb ~]# rpm -qa | grep mysql

mysql80-community-release-el9-1.noarch

mysql-community-common-8.0.32-1.el9.x86_64

mysql-community-client-plugins-8.0.32-1.el9.x86_64

mysql-community-libs-8.0.32-1.el9.x86_64

mysql-community-client-8.0.32-1.el9.x86_64

mysql-community-icu-data-files-8.0.32-1.el9.x86_64

mysql-community-server-8.0.32-1.el9.x86_64

# 启动 mysql

[root@bb ~]# systemctl start mysqld

[root@bb ~]# systemctl status mysqld

● mysqld.service - MySQL Server

Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)

Active: active (running) since Sat 2023-02-11 01:51:50 CST; 5s ago

Docs: man:mysqld(8)

http://dev.mysql.com/doc/refman/en/using-systemd.html

Process: 5116 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0/SUCCESS)

Main PID: 5186 (mysqld)

Status: "Server is operational"

Tasks: 39 (limit: 36075)

Memory: 474.3M

CPU: 4.779s

CGroup: /system.slice/mysqld.service

└─5186 /usr/sbin/mysqld

Feb 11 01:51:44 192.168.156.128 systemd[1]: Starting MySQL Server...

Feb 11 01:51:50 192.168.156.128 systemd[1]: Started MySQL Server.

# mysql的初始密码在/var/log/mysqld.log日志文件里,通过用grep 筛查出来

[root@bb ~]# grep 'temporary password' /var/log/mysqld.log

2023-02-10T17:51:47.367433Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: 9BtdoxMOvn.Y

# -u用户名 -p密码

[root@bb ~]# mysql -uroot -p'9BtdoxMOvn.Y'

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 8

Server version: 8.0.32

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> ALTER USER 'root'@'localhost' IDENTIFIED BY 'Admin123!';

Query OK, 0 rows affected (0.00 sec)

mysql> show databases;

+--------------------+

| Database |

+--------------------+

| information_schema |

| mysql |

| performance_schema |

| sys |

+--------------------+

4 rows in set (0.00 sec)

本地安

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值