首页 > 数据库 >在CentOS8下安装MySQL8.0.31

在CentOS8下安装MySQL8.0.31

时间:2023-08-29 19:35:56浏览次数:78  
标签:8.0 31 el8 MySQL8.0 mysql 64 rpm CentOS8

一、登录官网主页:https://www.mysql.com/downloads/,选择社区版下载,如下图:

 选择MySQL Community Server:

 选择Archives:

 

按照下图步骤,获取下载的IP地址

 

 

最终拿到的官网地址为:https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar

二、获取 MySQL 8.0.31

进入CentOS系统后,创建一个下载目录,开始下载软件:

wget https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar

执行结果:

--2023-04-23 09:37:14--  https://downloads.mysql.com/archives/get/p/23/file/mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar

Resolving downloads.mysql.com (downloads.mysql.com)... 104.71.161.87, 2600:140b:2:99c::2e31, 2600:140b:2:99d::2e31

Connecting to downloads.mysql.com (downloads.mysql.com)|104.71.161.87|:443... connected.

HTTP request sent, awaiting response... 302 Moved Temporarily

Location: https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar [following]

--2023-04-23 09:37:15--  https://cdn.mysql.com/archives/mysql-8.0/mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar

Resolving cdn.mysql.com (cdn.mysql.com)... 104.86.177.34

Connecting to cdn.mysql.com (cdn.mysql.com)|104.86.177.34|:443... connected.

HTTP request sent, awaiting response... 200 OK

Length: 879155200 (838M) [application/x-tar]

Saving to: ‘mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar’

mysql-8.0.31-1.el8. 100%[===================>] 838.43M  5.79MB/s    in 1m 55s

2023-04-23 09:39:11 (7.28 MB/s) - ‘mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar’ saved [879155200/879155200]

 

解压:

tar -xvf mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar

执行结果:

mysql-community-client-8.0.31-1.el8.x86_64.rpm

mysql-community-client-debuginfo-8.0.31-1.el8.x86_64.rpm

mysql-community-client-plugins-8.0.31-1.el8.x86_64.rpm

mysql-community-client-plugins-debuginfo-8.0.31-1.el8.x86_64.rpm

mysql-community-common-8.0.31-1.el8.x86_64.rpm

mysql-community-debuginfo-8.0.31-1.el8.x86_64.rpm

mysql-community-debugsource-8.0.31-1.el8.x86_64.rpm

mysql-community-devel-8.0.31-1.el8.x86_64.rpm

mysql-community-icu-data-files-8.0.31-1.el8.x86_64.rpm

mysql-community-libs-8.0.31-1.el8.x86_64.rpm

mysql-community-libs-debuginfo-8.0.31-1.el8.x86_64.rpm

mysql-community-server-8.0.31-1.el8.x86_64.rpm

mysql-community-server-debug-8.0.31-1.el8.x86_64.rpm

mysql-community-server-debug-debuginfo-8.0.31-1.el8.x86_64.rpm

mysql-community-server-debuginfo-8.0.31-1.el8.x86_64.rpm

mysql-community-test-8.0.31-1.el8.x86_64.rpm

mysql-community-test-debuginfo-8.0.31-1.el8.x86_64.rpm

三、开始安装 MySQL 8.0.31

安装之前,需要先安装net-tools和perl,采用yum安装的方式:

tar -xvf mysql-8.0.31-1.el8.x86_64.rpm-bundle.tar
yum install -y perl

然后开始分6步安装软件:

rpm -ivh mysql-community-common-8.0.31-1.el8.x86_64.rpm

执行结果:

warning: mysql-community-common-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY

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

Preparing...                          ################################# [100%]

Updating installing...

   1:mysql-community-common-8.0.31-1.e################################# [100%]

 

rpm -ivh mysql-community-client-plugins-8.0.31-1.el8.x86_64.rpm

执行结果:

warning: mysql-community-client-plugins-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY

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

Preparing...                          ################################# [100%]

Updating installing...

   1:mysql-community-client-plugins-8.################################# [100%]

 

rpm -ivh mysql-community-libs-8.0.31-1.el8.x86_64.rpm

执行结果:

warning: mysql-community-libs-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY

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

Preparing...                          ################################# [100%]

Updating installing...

   1:mysql-community-libs-8.0.31-1.el8################################# [100%]

 

rpm -ivh mysql-community-client-8.0.31-1.el8.x86_64.rpm

执行结果:

warning: mysql-community-client-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY

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

Preparing...                          ################################# [100%]

Updating installing...

   1:mysql-community-client-8.0.31-1.e################################# [100%]

 

rpm -ivh mysql-community-icu-data-files-8.0.31-1.el8.x86_64.rpm

执行结果:

warning: mysql-community-icu-data-files-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY

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

Preparing...                          ################################# [100%]

Updating installing...

   1:mysql-community-icu-data-files-8.################################# [100%]

 

rpm -ivh mysql-community-server-8.0.31-1.el8.x86_64.rpm

执行结果:

warning: mysql-community-server-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY

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

Preparing...                          ################################# [100%]

Updating installing...

   1:mysql-community-server-8.0.31-1.e################################# [100%]

如果执行该步安装时报如下错误:

[root@one mysqlpkg]# rpm -ivh mysql-community-server-8.0.31-1.el8.x86_64.rpm
warning: mysql-community-server-8.0.31-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
mariadb-connector-c-config is obsoleted by mysql-community-server-8.0.31-1.el8.x86_64

解决办法:yum remove掉即可,代码如下

yum remove mariadb-connector-c-config -y

 

 四、MySQL安装完的验证

上面的6个软件包装完后,MySQL就已经安装完成。可以做如下验证操作:

查看软件包

rpm -qa | grep -i mysql

执行结果:

mysql-community-common-8.0.31-1.el8.x86_64

mysql-community-icu-data-files-8.0.31-1.el8.x86_64

mysql-community-client-plugins-8.0.31-1.el8.x86_64

mysql-community-client-8.0.31-1.el8.x86_64

mysql-community-libs-8.0.31-1.el8.x86_64

mysql-community-server-8.0.31-1.el8.x86_64

查看安装的文件情况:

find / -name mysql

执行结果:

/etc/logrotate.d/mysql

/var/lib/selinux/targeted/active/modules/100/mysql

/var/lib/mysql

/usr/bin/mysql

/usr/lib64/mysql

/usr/share/selinux/targeted/default/active/modules/100/mysql

/soft/mysql

查看安装的软件版本:

mysql -V

执行结果:

mysql  Ver 8.0.31 for Linux on x86_64 (MySQL Community Server - GPL)

 

最后就是启动服务,并将服务写入开机自启中,并查看服务状态:

systemctl enable mysqld && systemctl start mysqld && systemctl status mysqld

执行结果:

mysqld.service - MySQL Server

   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor pres>

   Active: active (running) since Sun 2023-04-23 10:02:45 CST; 5h 22min ago

     Docs: man:mysqld(8)

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

  Process: 1098 ExecStartPre=/usr/bin/mysqld_pre_systemd (code=exited, status=0>

 Main PID: 1145 (mysqld)

   Status: "Server is operational"

    Tasks: 38 (limit: 23507)

   Memory: 439.1M

   CGroup: /system.slice/mysqld.service

           └─1145 /usr/sbin/mysqld

Apr 23 10:02:42 MySQL systemd[1]: Starting MySQL Server...

Apr 23 10:02:45 MySQL systemd[1]: Started MySQL Server.

 

五、MySQL初始化

MySQL安装完成后,需要做一些初始化操作,比方说更改默认密码等:

查看临时密码:

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

执行结果:

[Note] [MY-010454] [Server] A temporary password is generated for root@localhost: j-Sk87LZ,?!j

 通过临时密码登录MySQL命令行

mysql -u root -p

Enter password:

执行结果:

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

Your MySQL connection id is 8

Server version: 8.0.31

 

Copyright (c) 2000, 2022, 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.

 

更改root账号的密码:

alter user root@localhost identified by 'Zqx9876@54';

执行结果:

Query OK, 0 rows affected (0.00 sec)

 

更改数据库

use mysql;

执行结果:

Reading table information for completion of table and column names

You can turn off this feature to get a quicker startup with -A

 

Database changed

 

更新root账号的登录范围

update user set Host='%' where User='root' and Host='localhost';

执行结果:

Query OK, 1 row affected (0.00 sec)

Rows matched: 1  Changed: 1  Warnings: 0

 

刷新权限

flush privileges;

 

退出

exit

 

至此,数据库安装配置就算成功了,后面就只剩指定路径及导入数据库的工作了。

 

 

标签:8.0,31,el8,MySQL8.0,mysql,64,rpm,CentOS8
From: https://www.cnblogs.com/yiming523/p/17665675.html

相关文章

  • 电动牙刷上架亚马逊美国站UL4131测试报告
    在我们的日常生活中,电动牙刷已经成为了许多人日常清洁牙齿的必备工具。然而,在将其推向市场的过程中,制造商们必须遵守一系列的法规和标准,以确保产品的安全性和质量。这其中就包括了我们今天要讨论的UL4131标准。UL4131标准是一款关于个人保健电器类的产品安全标准,它主要关注的是个人......
  • Atcoder Beginner Contest 317 解题报告
    AtcoderBeginnerContest317ABC316咋没了。暂时A~E。HintsD$\quad$可以算出每次选举需要的改票数。然后变成了一个经典问题。E$\quad$有点naive。不用担心暴力扫T掉,时间复杂度是真的。F$\quad$F1$\qquadn$这么大一维都枚举不了……诶,$a_i$只有$10$?$\qua......
  • AtCoder Beginner Contest 317 F - Nim
    数位DP#include<bits/stdc++.h>usingnamespacestd;usingll=longlong;intdp[64][10][10][10][2][2][2][2][2][2];intmain(){lln;intb1,b2,b3;cin>>n>>b1>>b2>>b3;memset(dp,-1,sizeofdp);strings......
  • 20230531 java.util.Objects
    介绍java.util.ObjectspublicfinalclassObjectsAPIstaticequalsdeepEquals比较数组元素hashCodehash为一系列输入值生成哈希码toStringStringtoString(Objecto)StringtoString(Objecto,StringnullDefault)compare<T>intcompare(Ta,Tb,......
  • CF231E Cactus
    CF231ECactus点仙人掌的性质:每个点最多只在一个环里。对于\(u,v\)之间的路径,显然一定是由一些链和一些环拼接而成的。对于链,只能按照唯一的方式行走。对于环,有两种走的方案:顺时针和逆时针走。各个环间互不影响,乘法原理得到答案就是\(2\)的环个数次方。边双所点后维护......
  • Programming abstractions in C阅读笔记:p130-p131
    《ProgrammingAbstractionsInC》学习第52天,p130-p131,总结如下:一、技术总结1.piglatingame通过piglatingame掌握字符复制,指针遍历等操作。/**输入:字符串,这里采用书中坐着自定义的getline函数*/#include<stdio.h>#include<string.h>#include"simpio.h"#def......
  • ABC317F题解
    让人头大的数位DP。建议评蓝。个人认为不适合放ABC的F。将三个数二进制拆分,使三个数异或为0相当于每个二进制位三个数中有0或2个是1。所以考虑数位DP,设\(dp[i][m1][m2][m3][lim1][lim2][lim3]\)为第\(i\)位,三个数模\(a\),\(b\),\(c\)分别是\(m1\),\(m2\),\(m3\)......
  • 【INFINI Workshop 深圳站】8 月 31 日一起动手实验玩转 Easysearch
    8月31日下午和INFINILabs的技术专家面对面,第一时间了解极限实验室的发布最新产品和功能特性,通过动手实战,快速掌握最前沿的搜索技术,并用于实际项目中。欢迎大家免费报名参加。活动时间:2023-08-3113:30~17:30活动地点:广东深圳南山区科发路91号华润置地大厦D座5层05A会议室......
  • [ABC317G] Rearranging 题解
    取自我的洛谷博客:https://www.luogu.com.cn/blog/SunnyYuan/solution-at-abc317-g借鉴了官方题解思路。思路首先我们要建立一个二分图。对于输入的\(a_{i,j}\),我们可以连接左侧的\(i\)和右侧的\(a_{i,j}\)。比如样例\(1\):注意:左边的\(1,2,3\)和右边的\(1,2......
  • 「Stoi2031」枫
    题目大意给定\(n,k\),对\(1,2,\dots,n\)一直操作,每次操作交替从小到大或从大到小的顺序取走当前的第\((k+1)x+1\)个数(\(x\in\mathbb{N}^+\)且\((k+1)x+1\)不超过剩余数总数),求最后一个取走的数的编号。多次询问。思路记\(f_n\)为有\(n\)个数时的答案。假设我们现......