欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

MySQL8.0初体验

程序员文章站 2022-09-14 16:32:24
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功能体验