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 |
官方参考: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二进制包数据库安装完毕,开始体验其功能。