zoukankan      html  css  js  c++  java
  • MySQL8.0初体验

    MySQL8.0的官方社区开源版出来有段时间了,而percona的8.0版本还没有正式对外发布(已发布测试版),一直以来也没安装体验下这个号称质的飞跃的版本,今天正好有些时间就下了安装体验体验。

    一、MySQL8.0下载

    下载地址:https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz

    二、安装环境

    软件名称 软件版本 备注
    操作系统 RHEL6.6_X86_64  
    数据库 MySQL8.0.13  

    三、MySQL8.0安装

    官方参考:https://dev.mysql.com/doc/refman/8.0/en/binary-installation.html

    1.软件下载

    [root@node tools]# wget https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz

    2.依赖包安装

    [root@node mysql]# yum search libaio
    [root@node mysql]# yum install libaio
    3.用户创建
    [root@node mysql]# groupadd mysql
    [root@node mysql]# useradd -r -g mysql -s /bin/false mysql

    4.解压缩安装包

    [root@node mysql]# cd /usr/local
    [root@node mysql]# tar -xvf mysql-8.0.13-linux-glibc2.12-x86_64.tar.xz

    5.规划软件和数据文件目录
    [root@node tools]# mv mysql-8.0.13-linux-glibc2.12-x86_64 /usr/local/mysql
    [root@node mysql]# cd /usr/local/mysql
    [root@node mysql]# mkdir -p /data/mysql/data

    6.修改属主权限
    [root@node mysql]# chown -R mysql:mysql /data/mysql/data
    [root@node mysql]# chmod -R 750 /data/mysql/data

    7.数据库初始化
    [root@node mysql]# bin/mysqld --initialize --user=mysql  --datadir=/data/mysql/data
    2018-11-12T02:49:23.293863Z 0 [System] [MY-013169] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.13) initializing of server in progress as process 24839
    2018-11-12T02:49:26.840424Z 5 [Note] [MY-010454] [Server] A temporary password is generated for root@localhost: Vxxx1n%Mj7uZ
    2018-11-12T02:49:29.671663Z 0 [System] [MY-013170] [Server] /usr/local/mysql/bin/mysqld (mysqld 8.0.13) initializing of server has completed
    8.ssl部署
    [root@node mysql]# bin/mysql_ssl_rsa_setup
    Generating a 2048 bit RSA private key
    .......+++
    ............................+++
    writing new private key to 'ca-key.pem'
    -----
    Generating a 2048 bit RSA private key
    ...........................................+++
    ..+++
    writing new private key to 'server-key.pem'
    -----
    Generating a 2048 bit RSA private key
    ..................................................................+++
    ...................+++
    writing new private key to 'client-key.pem'
    -----
    9.启动数据库
    [root@node mysql]# bin/mysqld_safe --user=mysql --datadir=/data/mysql/data &
    [1] 25195
    [root@node mysql]# Logging to '/data/mysql/data/node.err'.
    2018-11-12T02:51:59.390239Z mysqld_safe Starting mysqld daemon with databases from /data/mysql/data
    10.连接数据库
    [root@node mysql]# mysql -uroot -p'Vjk01n%Mj7uZ'  -hlocalhost

    mysql> select user,host from mysql.user;
    ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.

    11.修改数据库初始密码

    mysql> alter user root@'localhost' identified by 'xxxx';
    Query OK, 0 rows affected (0.07 sec)
    12.数据库查询
    mysql> select user,host from mysql.user;   
    +------------------+-----------+
    | user             | host      |
    +------------------+-----------+
    | mysql.infoschema | localhost |
    | mysql.session    | localhost |
    | mysql.sys        | localhost |
    | root             | localhost |
    +------------------+-----------+
    4 rows in set (0.00 sec)
    13.MySQL启动服务配置
    [root@node mysql]# cp -rp support-files/mysql.server  /etc/init.d/mysqld

    [root@node data]# chkconfig  --add mysqld
    [root@node mysql]# vi /etc/my.cnf

    [root@node ~]# vi /root/.bash_profile
    PATH=$PATH:$HOME/bin:/usr/local/sysbench/bin:/usr/local/mysql/bin/
    [root@node ~]# source ~/.bash_profile
    14.杀掉MySQL进程,通过service服务重启数据库
    [root@node data]# service mysqld start
    Starting MySQL..................                           [  OK  ]


    至此MySQL8.0二进制包数据库安装完毕,开始体验其功能。
    四、MySQL8.0功能体验

     https://www.mysql.com/why-mysql/white-papers/whats-new-mysql-8-0/

    MySQL8.0号称快于5.7历史版本2倍的速度(MySQL 8.0: Up to 2x Faster)

    1.数据字典innodb表
    2.密码加密方式更改
    3.默认字符集utf8mb4
    4.json功能加强
    5.SQL功能加强
    6.窗口函数
    7.隐藏索引
    8.降序索引
    9.查询一致性改善
    10.优化直方图

  • 相关阅读:
    大小端判断
    引用计数
    STL_ALGORITHM_H
    书单一览
    GIT版本控制系统(二)
    JS随机数生成算法
    STL学习笔记--临时对象的产生与运用
    乱序优化与GCC的bug
    你的灯亮着吗?
    交换机和路由器
  • 原文地址:https://www.cnblogs.com/rangle/p/9945105.html
Copyright © 2011-2022 走看看