zoukankan      html  css  js  c++  java
  • 【Linux】【MySQL】CentOS7安装最新版MySQL8.0.13(最新版MySQL从安装到运行)

     

    1、前言

      框框博客在线报时:2018-11-07 19:31:06

      当前MySQL最新版本:8.0.13 (听说比5.7快2倍)

      官方之前表示:MySQL 8.0 正式版 8.0.11 已发布,MySQL 8 要比 MySQL 5.7 快 2 倍,还带来了大量的改进和更快的性能!

      开源中国介绍文档:MySQL 8.0 正式版 8.0.11 发布:比 MySQL 5.7 快 2 倍

    2、开始

      1、我的设备介绍

        服务器:2018-11-06 新购置 的 阿里云CentOS7 服务器;

        系统镜像采用阿里云自家默认的CentOS7镜像;

      2、准备

        首先你得登陆到自己的服务器。

        SSH证书免密码远程登陆Linux(Putty)

      3、获取MySQL最新版 rpm包 集合 的下载地址(获取最新版MySQL下载地址方法)

        MySQL下载页面:https://dev.mysql.com/downloads/mysql/8.0.html

        

        我是CentOS系统 所以 我选择了 Red Hat。

        

        第一个为一个 tar归档包,里面是 后面所有 rpm 的打包(仔细看后面都是rpm 结尾的)

        点击右边Download

        

        这就是最新版 MySQL资源链接 :https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar

      4、wget下载到服务器

        

        我下载到 /tmp 目录下了。回车开始下载。

        

      5、解压MySQL归档包

        tar -xvf mysql-8.0.13-1.el7.x86_64.rpm-bundle.tar

        

      6、开始安装

        1、当中会遇到的问题

          1、mysql-community-libs .... 这两个包安装不上。

            原因:我们在Linux系统中,如果要使用关系型数据库的话,基本都是用的mysql。

            而且以往7以下版本的centos系统都是默认的集成有mysql。

            然而对于现在最新的centos7系统来说,已经不支持mysql数据库,它默认内部集成了mariaDB。

            如果我们想要使用 mysql 的话,就要先将原来的mariaDB卸载掉,不然会引起冲突。

            解决方案:卸载maridb (rpm 不会卸载软件的 自行百度)

            查看安装的 mariaDB:rpm -qa | grep mariadb

            卸载:rpm -e ***(*** 为软件名)

            如果不能卸载则即可:rpm -e --nodeps ***(*** 为软件名)

          2、缺少依赖包 libaio

            libaio.so.1()(64bit) is needed by MySQL-server 问题

            直接实用yum包管理工具安装即可:yum install libaio

         2、使用 rpm -vih XXXXXX(XXXXXX 为 rpm包全名)

          按照依赖顺序依次安装(能安装的安装就行,像test这个不方便安装就算了。)

          mysql-community-common-8.0.13-1.el7.x86_64

          mysql-community-libs-8.0.13-1.el7.x86_64

          mysql-community-libs-compat-8.0.13-1.el7.x86_64

          mysql-community-client-8.0.13-1.el7.x86_64

          mysql-community-embedded-compat-8.0.13-1.el7.x86_64

          mysql-community-server-8.0.13-1.el7.x86_64

       7、启动MySQL服务,并设置root密码

        1、启动mysql服务

          service mysqld restart

        2、初次安装mysql,root账户没有密码。
    [root@izuf6 tmp]# mysql -u root
    Welcome to the MySQL monitor.  Commands end with ; or g.
    Your MySQL connection id is 15
    Server version: 8.0.13 MySQL Community Server - GPL
    
    Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    
    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> show databases;
    +--------------------+
    | Database           |
    +--------------------+
    | information_schema |
    | mysql              |
    | performance_schema |
    | test               |
    +--------------------+
    rows in set (0.01 sec)
    
    mysql>

        设置密码:

    mysql> set password for 'root'@'localhost' =password('password');
    Query OK, 0 rows affected (0.00 sec)
    
    mysql> 

        不需要重启数据库即可生效。

        3、使用样例

      6、MySQL一些骚炒作

    -- 登录sys数据库
    mysql -u root -proot sys
    
    -- 查看所有的数据库
    select database()
    
    -- 查看数据库
    show databases;
    
    -- 模糊查询包含y的数据库
    show databases like '%y%';
    
    -- 查看表
    show tables;
    
    --模糊查询包含user的表
    show tables like '%user%';
    
    -- 查看列, 查看user表信息
    desc user;

    -- 查看username用户被赋予的权限
    show grants for username;

    3、后言

      1、安装过程中有两个依赖需要注意的地方,之后就很好做了。

      途中还学习到了,Mysql5、8的密码重置问题,有点意思。

    4、修改时间记录

      2018-11-07 20:28:05 -> 2018-11-09 16:16:18 -> 2018-11-09 20:32:42 

  • 相关阅读:
    JetBrains——账户登录错误(JetBrains Account Error:JetBrains Account connection error: www.jetbrains.com)解决方案
    pip list出错原因
    MyBatis 动态SQL
    MyBatis Mapper文件简述
    MyBatis XML配置
    MyBatis 简单笔记
    nginx配置文件参考
    CentOS 8 下 nginx 服务器安装及配置笔记
    CentOS8 下 Redis5.0.7 哨兵Sentinel 模式配置指南
    shell script简单笔记
  • 原文地址:https://www.cnblogs.com/Twobox/p/9925460.html
Copyright © 2011-2022 走看看