您的位置:首页 > 运维架构 > Linux

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

2018-07-27 17:04 726 查看

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

  • 服务器下载mysql 8.0
[code][root@izbp1es7c0 soft]# wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar
  • 解压得到安装文件
[code][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
  • 逐个安装以下文件
[code][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%]
[code][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%]

 

[code][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%]
[code][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

[code][root@izbp1es7c0 soft]# yum install libaio

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

[code][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 进行配置。

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

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

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


 


 

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: