Rocky linux 9.0系统安装MySQL5.7

前言

本文将带你在Rocky linux 9.0上折腾一个MySQL5.7, 说干就干。

安装环境

  • 删除系统中可能存在的包:
[root@mufeng ~]# rpm -qa |grep mysql
[root@mufeng ~]# rpm -qa |grep mariadb
[root@mufeng ~]#

查看ip和系统:


```bash
[root@mufeng ~]# cat /etc/redhat-release 
Rocky Linux release 9.1 (Blue Onyx)

[root@mufeng ~]# ifconfig |grep inet |awk 'NR==1{print $2}'
192.168.1.55

下载mysql 包

下载地址: https://downloads.mysql.com/archives/community/

在这里插入图片描述

[root@mufeng tools]# pwd
/tools
[root@mufeng tools]# ls
mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar
[root@mufeng tools]# tar xf mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar 
[root@mufeng tools]# 

解压后,可以查看包:

[root@mufeng tools]# ls
mysql-5.7.39-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-5.7.39-1.el7.x86_64.rpm
mysql-community-common-5.7.39-1.el7.x86_64.rpm
mysql-community-devel-5.7.39-1.el7.x86_64.rpm
mysql-community-embedded-5.7.39-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.39-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.39-1.el7.x86_64.rpm
mysql-community-libs-5.7.39-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.39-1.el7.x86_64.rpm
mysql-community-server-5.7.39-1.el7.x86_64.rpm
mysql-community-test-5.7.39-1.el7.x86_64.rpm

包很多,不用全部安装

开始安装

安装依赖

[root@mufeng tools]# yum install libncurses*

按照我下面的顺序安装即可

    27  rpm -ivh mysql-community-common-5.7.39-1.el7.x86_64.rpm 
   28  rpm -ivh mysql-community-libs-5.7.39-1.el7.x86_64.rpm 
   32  rpm -ivh mysql-community-client-5.7.39-1.el7.x86_64.rpm --nodeps
   33  rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm --force --nodeps
   

依赖包解决

ln -s /usr/lib64/libncurses.so.6 /usr/lib64/libncurses.so.5
ln -s /usr/lib64/libtinfo.so.6 /usr/lib64/libtinfo.so.5

启动测试

  • 启动并查找密码
[root@mufeng lib64]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service

[root@mufeng lib64]# grep password /var/log/mysqld.log 
2023-06-16T02:33:47.158542Z 1 [Note] A temporary password is generated for root@localhost: jtt&wkpsy95O
[root@mufeng lib64]# 

  • 登录测试

```bash
[root@mufeng ~]# mysql -p'jtt&wkpsy95O'
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 2
Server version: 5.7.39

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> 

总结

在Rocky系统中安装MySQL5.7,已经成功安装了,更多内容可以在csdn搜索 :我是沐风晓月

猜你喜欢

转载自blog.csdn.net/wisdom_futrue/article/details/131241279