mysql的安装(yum源安装、下载RPM包安装、二进制安装)

本文详细介绍了在Linux上安装MySQL的三种方法:官方yum源安装、下载RPM包安装和通用二进制安装。内容包括安装步骤、依赖处理、启动流程以及root密码设置。适合运维人员参考。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

安装包获取

https://dev.mysql.com/downloads/mysql/
https://dev.mysql.com/downloads/repo/yum/

方法一:官方yum源方式安装

yum install mysql80-community-release-el7-3.noarch.rpm
yum list | grep "mysql-community"
yum install mysql-community-client mysql-community-server


方法二:下载RPM包安装

注意:该方法安装时,虽然安装包已经下载到了本地,但是在安装的过程中任然可能存在依赖,因此修改安装网络源来接触依赖

常用的国内yum源如下:具体配置方法参考基础课件。
网易163 yum源,安装方法查看:http://mirrors.163.com/.help/
中科大的 yum源,安装方法查看:https://lug.ustc.edu.cn/wiki/mirrors/help
sohu的 yum源,安装方法查看: http://mirrors.sohu.com/help/
阿里云的 yum源,安装方法查看: http://mirrors.aliyun.com/repo/
清华大学的 yum源,安装方法查看: https://mirrors.tuna.tsinghua.edu.cn/
浙江大学的 yum源,安装方法查看: http://mirrors.zju.edu.cn/
中国科技大学yum源,安装方法查看: http://centos.ustc.edu.cn/

安装步骤:

  • 1、卸载Mariadb
    rpm -e mariadb-libs postfix
  • 2、安装
[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql
[root@localhost ~]# mkdir mysql
[root@localhost ~]# tar xf mysql-8.0.16-2.el7.x86_64.rpm-bundle.tar -C mysql
[root@localhost ~]# cd mysql
[root@localhost mysql]# yum localinstall mysql-community-client-8.0.16-
2.el7.x86_64.rpm mysql-community-server-8.0.16-2.el7.x86_64.rpm mysql-community-
libs-8.0.16-2.el7.x86_64.rpm mysql-community-common-8.0.16-2.el7.x86_64.rpm
  • 3、启动
[root@localhost ~]# systemctl start mysqld
[root@localhost ~]# systemctl enable mysqld
  • 4、mysql安装完成之后,在/var/log/mysqld.log文件中给root生成了一个默认密码。通过下面的方式找到root默认密码,然后登录mysql进行修改:
[root@localhost ~]# grep "temporary password" /va
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值