关键词搜索

源码搜索 ×
×

MySQL5.7.x 安装 Linux7环境

发布2021-10-25浏览538次

详情内容

一、软件安装
1. 下载
wget https://downloads.mysql.com/archives/get/phttps://files.jxasp.com/image/23/file/mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar

    https://dev.mysql.com/downloads/mysql/
    在这里插入图片描述
    在这里插入图片描述

    2. 解压
    tar -xvf mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar
    

      解压后的列表:

       mysql-5.7.33-1.el7.x86_64.rpm-bundle.tar
       mysql-community-client-5.7.33-1.el7.x86_64.rpm
       mysql-community-common-5.7.33-1.el7.x86_64.rpm
       mysql-community-devel-5.7.33-1.el7.x86_64.rpm
       mysql-community-embedded-5.7.33-1.el7.x86_64.rpm
       mysql-community-embedded-compat-5.7.33-1.el7.x86_64.rpm
       mysql-community-embedded-devel-5.7.33-1.el7.x86_64.rpm
       mysql-community-libs-5.7.33-1.el7.x86_64.rpm
       mysql-community-libs-compat-5.7.33-1.el7.x86_64.rpm
       mysql-community-server-5.7.33-1.el7.x86_64.rpm
       mysql-community-test-5.7.33-1.el7.x86_64.rpm
      
        2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      3.安装

      安装优先级:

      rpm -ivh mysql-community-common-5.7.33-1.el7.x86_64.rpm
      rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm
      rpm -ivh  mysql-community-client-5.7.33-1.el7.x86_64.rpm
      rpm -ivh  mysql-community-server-5.7.33-1.el7.x86_64.rpm
      
        2
      • 3
      • 4
      4. 跳过权限
      # 配置mysql
      vim /etc/my.cnf
      
      # 在[mysqld]标签下面添加,跳过校验
      skip-grant-tables
      
        2
      • 3
      • 4
      • 5
      5. 启动mysql服务端
      # 启动mysql服务端
      systemctl start mysqld.service
      
      # 使用客户端连接server端
      mysql,按回车
      
        2
      • 3
      • 4
      • 5
      6. 设置密码
      # 设置密码
      update mysql.user set authentication_string=password('123456') where user='root';
      
      # 刷新权限
      flush privileges;
      
        2
      • 3
      • 4
      • 5
      7. 允许远程连接
      # 允许远程连接
      GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION; 
      
        2
      8.开发3306端口
      # 开放端口(开放后需要要重启防火墙才生效)
      firewall-cmd --zone=public --add-port=8080/tcp --permanent
      # 重新启动防火墙	
      firewall-cmd --reload
      
        2
      • 3
      • 4
      二、安装报错方案

      没遇到则可以跳过,

      安装报错:
      [root@bogon app]# rpm -ivh mysql-community-libs-5.7.33-1.el7.x86_64.rpm
      警告:mysql-community-libs-5.7.33-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
      错误:依赖检测失败:
              mysql-community-common(x86-64) >= 5.7.9 被 mysql-community-libs-5.7.33-1.el7.x86_64 需要
              mariadb-libs 被 mysql-community-libs-5.7.33-1.el7.x86_64 取代
      [root@bogon app]# 
      
      ----------------------------------------------------------------
      原因是 centos7  默认安装mariadb-libs包,需要卸载
      
      # 查看mariadb
      [root@bogon app]# rpm -qa |grep mariadb
      mariadb-libs-5.5.68-1.el7.x86_64
      
      # 卸载mariadb
      rpm -e --nodeps mariadb-libs-5.5.68-1.el7.x86_64
      
      # 跳过签名校验安装mysql(如果遇到签名错误,执行这条命令)
      rpm -ivh --force --nodeps mysql-community-libs-5.7.33-1.el7.x86_64.rpm
      
        2
      • 3
      • 4
      • 5
      • 6
      • 7
      • 8
      • 9
      • 10
      • 11
      • 12
      • 13
      • 14
      • 15
      • 16
      • 17
      • 18
      • 19
      • 20

      相关技术文章

      点击QQ咨询
      开通会员
      返回顶部
      ×
      微信扫码支付
      微信扫码支付
      确定支付下载
      请使用微信描二维码支付
      ×

      提示信息

      ×

      选择支付方式

      • 微信支付
      • 支付宝付款
      确定支付下载