MySQL8.0的官方社區開源版出來有段時間了,而percona的8.0版本還沒有正式對外發佈(已發佈測試版),一直以來也沒安裝體驗下這個號稱質的飛躍的版本,今天正好有些時間就下了安裝體驗體驗。 一、MySQL8.0下載 下載地址:https://dev.mysql.com/get/Download ...
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)