liunx7.9安装mysql8.0.29操作流程说明

mysql是目前主流的数据库之一,下面开始介绍详细的安装操作流程与步骤以及出现的问题与解决方案。,开始吧~~~~

  1. 下载Mysql安装包
  2. 安装
  3. 相关配置

一、下载MYSQL安装包

下载地址:https://dev.mysql.com/downloads/mysql/ 根据自己的系统版本进行下载对应的包,我这边选择的是 Red Hat Enterprise Liunx / Oracle Linux -- > Red Hat Enterprise Liunx 7/ Oracle Linux7(x86,64-bit) 

一共需要下载4个文件:

mysql-community-libs-8.0.29-1.el7.x86_64.rpm

mysql-community-common-8.0.29-1.el7.x86_64.rpm

mysql-community-server-8.0.29-1.el7.x86_64.rpm

mysql-community-client-8.0.29-1.el7.x86_64.rpm

二、MYSQL详细安装

上传到Liunx服务器,进行先后顺序执行。命令如下。

1. 检查是否自带mariadb数据库,如果存在,则执行删除命令。

### 检查是否存在
rpm -qa|grep mariadb

### 删除mariadb
rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

2. 安装mysql包

### 第1步
rpm -ivh mysql-community-common-8.0.29-1.el7.x86_64.rpm

### 第2步
rpm -ivh mysql-community-libs-8.0.29-1.el7.x86_64.rpm --force --nodeps

### 第3步
rpm -ivh mysql-community-client-8.0.29-1.el7.x86_64.rpm --force --nodeps

### 第4步
rpm -ivh mysql-community-server-8.0.29-1.el7.x86_64.rpm --force --nodeps

=======================================执行成功截图===================================
[root@lcndc2appdbts01 mysql]# rpm -ivh mysql-community-common-8.0.29-1.el7.x86_64.rpm
warning: mysql-community-common-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-8.0.29-1.e################################# [100%]
[root@lcndc2appdbts01 mysql]# rpm -ivh mysql-community-libs-8.0.29-1.el7.x86_64.rpm
warning: mysql-community-libs-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
error: Failed dependencies:
        mysql-community-client-plugins = 8.0.29-1.el7 is needed by mysql-community-libs-8.0.29-1.el7.x86_64
[root@lcndc2appdbts01 mysql]# rpm -ivh mysql-community-libs-8.0.29-1.el7.x86_64.rpm --force --nodeps
warning: mysql-community-libs-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-8.0.29-1.el7################################# [100%]
[root@lcndc2appdbts01 mysql]# rpm -ivh mysql-community-client-8.0.29-1.el7.x86_64.rpm --force --nodeps
warning: mysql-community-client-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-8.0.29-1.e################################# [100%]
[root@lcndc2appdbts01 mysql]# rpm -qa | grep mysql
mysql-community-client-8.0.29-1.el7.x86_64
mysql-community-common-8.0.29-1.el7.x86_64
mysql-community-libs-8.0.29-1.el7.x86_64
[root@lcndc2appdbts01 mysql]# rpm -ivh mysql-community-server-8.0.29-1.el7.x86_64.rpm --force --nodeps
warning: mysql-community-server-8.0.29-1.el7.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID 3a79bd29: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-8.0.29-1.e################################# [100%]

 3. 启动,启动报错,排查处理

[root@lcndc2appdbts01 mysql]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

=================================解决方式=================================
因为下载的MYSQLliunx版本是8.0版本的。导致此问题。
重新下载liunx7.0版本正常。

=================================成功=================================
[root@lcndc2appdbts01 data]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service
[root@lcndc2appdbts01 data]# ps -ef | grep mysql
mysql     60988      1  7 16:49 ?        00:00:00 /usr/sbin/mysqld
root      61038  60734  0 16:49 pts/0    00:00:00 grep --color=auto mysql

三、相关配置 

1. 设置临时密码

### 获取临时密码
[root@lcndc2appdbts01 data]# grep 'temporary password' /var/log/mysqld.log
2022-07-21T08:49:02.218250Z 6 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: JwN6)jXoxUtJ

临时密码:JwN6)jXoxUtJ

2. 使用临时密码登录

[root@lcndc2appdbts01 data]# sudo 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.29

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.

mysql> 

3. 设置新密码与远程登录

### 修改临时密码,也可以不修改
alter user 'root'@'localhost' identified by '1oK3aH&52a1m8p;$fE';
Query OK, 0 rows affected (0.01 sec)

### 设置远程可访问
mysql> 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
mysql> select user,host from user;    -- 查询当前状态
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
| root             | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

mysql> update user set host="%" where user="root";   -- 修改可远程访问
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

mysql> select user,host from user;
+------------------+-----------+
| user             | host      |
+------------------+-----------+
| root             | %         |
| mysql.infoschema | localhost |
| mysql.session    | localhost |
| mysql.sys        | localhost |
+------------------+-----------+
4 rows in set (0.00 sec)

 4. 刷新授权(重点

flush privileges;

5. 使用Navicat或者其他工具验证

 ### 核心

大家安装的时候,一定要先看好自己的服务器系统版本,以免下错安装包造成安装过程中出现这种乱七八糟的问题。切记!!!

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

逍遥则子

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值