【Linux】【MySQL】CentOS7安裝最新版MySQL8.0.13(最新版MySQL從安裝到運行)

一、前言

  框框博客在線報時:2018-11-07 19:31:06html

  當前MySQL最新版本:8.0.13 (據說比5.7快2倍)node

  官方以前表示:MySQL 8.0 正式版 8.0.11 已發佈,MySQL 8 要比 MySQL 5.7 快 2 倍,還帶來了大量的改進和更快的性能!mysql

  開源中國介紹文檔:MySQL 8.0 正式版 8.0.11 發佈:比 MySQL 5.7 快 2 倍sql

二、開始

  一、個人設備介紹

    服務器:2018-11-06 新購置 的 阿里雲CentOS7 服務器;數據庫

    系統鏡像採用阿里雲自家默認的CentOS7鏡像;centos

  二、準備

    首先你得登錄到本身的服務器。服務器

    SSH證書免密碼遠程登錄Linux(Putty)app

  三、獲取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

  四、wget下載到服務器

    

    我下載到 /tmp 目錄下了。回車開始下載。

    

  五、解壓MySQL歸檔包

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

    

  六、開始安裝

    一、當中會遇到的問題

      一、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 ***(*** 爲軟件名)

      二、缺乏依賴包 libaio

        libaio.so.1()(64bit) is needed by MySQL-server 問題

        直接實用yum包管理工具安裝便可:yum install libaio

     二、使用 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

   七、啓動MySQL服務,並設置root密碼

    一、啓動mysql服務

      service mysqld restart

    二、初次安裝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>

    不須要重啓數據庫便可生效。

    三、使用樣例

  六、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;
複製代碼

三、後言

  一、安裝過程當中有兩個依賴須要注意的地方,以後就很好作了。

  途中還學習到了,Mysql五、8的密碼重置問題,有點意思。

四、修改時間記錄

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

相關文章
相關標籤/搜索