阿里云ESC CentOS 7.2 安装MySQL 8.0 笔记

       最近公司服务器由某数码迁移至阿里云,之前用的是mysql 5.6在迁移,查了下新版本的MySQL的新特性。发现mysql 8针对InnoDB 引擎做了性能提升,而且号称比5.7快2倍。所以决定直接跳过5.7,升级至8.0。以下是安装过程记录。

  • 服务器下载mysql 8.0
[root@izbp1es7c0 soft]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
  • 解压得到安装文件
[root@izbp1es7c0 soft]# tar -xvf mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
mysql-community-libs-8.0.11-1.el7.x86_64.rpm
mysql-community-common-8.0.11-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-8.0.11-1.el7.x86_64.rpm
mysql-community-devel-8.0.11-1.el7.x86_64.rpm
mysql-community-server-8.0.11-1.el7.x86_64.rpm
mysql-community-client-8.0.11-1.el7.x86_64.rpm
mysql-community-server-minimal-8.0.11-1.el7.x86_64.rpm
mysql-community-embedded-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-libs-compat-8.0.11-1.el7.x86_64.rpm
mysql-community-test-8.0.11-1.el7.x86_64.rpm
  • 逐个安装以下文件
[root@izbp1es7c0 soft]# rpm -ivh mysql-community-common-8.0.11-1.el7.x86_64.rpm 
warning: mysql-community-common-8.0.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-8.0.11-1.e################################# [100%]
[root@izbp1es7c0 soft]# rpm -ivh mysql-community-libs-8.0.11-1.el7.x86_64.rpm 
warning: mysql-community-libs-8.0.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-8.0.11-1.el7################################# [100%]

 

[root@izbp1es7c0 soft]# rpm -ivh mysql-community-client-8.0.11-1.el7.x86_64.rpm 
warning: mysql-community-client-8.0.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-8.0.11-1.e################################# [100%]
[root@izbp1es7c0 soft]# rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm 
warning: mysql-community-server-8.0.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
    libaio.so.1()(64bit) is needed by mysql-community-server-8.0.11-1.el7.x86_64
    libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-8.0.11-1.el7.x86_64
    libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-8.0.11-1.el7.x86_64

此时提升错误,需要安装libaio.so

[root@izbp1es7c0 soft]# yum install libaio

再次安装  mysql-community-server-8.0.11-1.el7.x86_64.rpm 

[root@izbp1es7c0bwaldjl2dzb0z soft]# rpm -ivh mysql-community-server-8.0.11-1.el7.x86_64.rpm 
warning: mysql-community-server-8.0.11-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-8.0.11-1.e################################# [100%]

至此mysql 安装完成,接下来进行对mysql 进行配置。

  • 初始化
[root@izbp1es7c0 soft]# mysqld --initialize

  此命令会在/var/log/mysqld.log生成一个随机密码,找到这个密码后面要用到

  • 修改mysql用户组
[root@izbp1es7c0 soft]# chown mysql:mysql /var/lib/mysql -R
  • 启动msyql 服务
[root@izbp1es7c0 soft]# systemctl start mysqld.service
  • 安全设置,修改root 密码,需要用到/var/log/mysqld.log 中生成的随机密码。
[root@izbp1es7c0 soft]# mysql_secure_installation
  • 根据提示输入密码和新密码,后面的会有一些配置步骤,根据提示和实际需要输入y或者n即可。
Securing the MySQL server deployment.

Enter password for user root: 

The existing password for the user account root has expired. Please set a new password.

New password: 

Re-enter new password: 
  • 配置完成之后,登录就可以登录Mysql了。
[root@izbp1es7c0 soft]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 11
Server version: 8.0.11 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 |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

mysql> 


 


 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值