Centos 6.5下mysql 8.0.11的rpm包的安装方式

1.系统版本及mysql下载地址

操作系统:Centos 6.5(Centos 7.4下载对应的mysql版本安装同理)

mysql数据库版本:mysql8.0.11

mysql官方网站:http://www.mysql.com

2.安装新版mysql之前,我们需要将系统自带的mariadb-lib卸载

  1. [bigdata@eric011 software-package]$ rpm -qa|grep mariadb
  2. mariadb-libs-5.5.56-2.el7.x86_64
  3. [bigdata@eric011 software-package]$ sudo rpm -e mariadb-libs-5.5.56-2.el7.x86_64 --nodeps
  4. [bigdata@eric011 software-package]$ rpm -qa|grep mysql
  5. mysql-community-common-8.0.11-1.el6.x86_64.rpm
  6. [bigdata@eric011 software-package]$ sudo rpm -e mysql-community-common-8.0.11-1.el6.x86_64.rpm

3.到mysql的官网下载最新版mysql的rpm集合包并解压:

mysql-8.0.11-1.el6.x86_64.rpm-bundle.tar
选择对应的系统版本

shell> wget https://cdn.mysql.com//Downloads/MySQL-8.0/mysql-8.0.11-1.el6.x86_64.rpm-bundle.tar

  1. centOS 7: mysql-8.0.11-1.el7.x86_64.rpm-bundle.tar

  2. centOS 6:mysql-8.0.11-1.el6.x86_64.rpm-bundle.tar

 4..其中最简单的安装mysql-server服务,只需要安装如下4个软件包即可,我们可以使用rpm -ivh命令进行安装

  1. shell> sudo rpm -ivh mysql-community-common-8.0.11-1.el6.x86_64.rpm
  2. shell> sudo rpm -ivh mysql-community-libs-8.0.11-1.el6.x86_64.rpm --(依赖于common)
  3. shell> sudo rpm -ivh mysql-community-client-8.0.11-1.el6.x86_64.rpm --(依赖于libs)
  4. shell> sudo rpm -ivh mysql-community-server-8.0.11-1.el6.x86_64.rpm --(依赖于client、common)

       1)遇到错误

  

  处理方法:

  1.shell> sudo yum install perl

  2.shell> yum install numactl

5.初始化mysql数据库

  shell>  sudo mysqld --initialize //该命令会在/var/log/mysqld.log生成随机密码

6.修改mysql数据库目录的所属用户及其所属组,然后启动mysql数据库

  shell>  sudo chown mysql:mysql /var/lib/mysql -R
  shell>  systemctl start mysqld.service

7.根据第6步中的密码,更改root用户的密码,新版的mysql必须先修改root用户的密码,否则登录后是不能执行任何命令的

  shell> mysql_secure_installation //根据提示修改root用户密码

8.安装完成,接下来既可以正常操作mysql

    1. [bigdata@eric011 lib]$ mysql -uroot -pxxxx
    2. mysql: [Warning] Using a password on the command line interface can be insecure.
    3. Welcome to the MySQL monitor. Commands end with ; or \g.
    4. Your MySQL connection id is 13
    5. Server version: 8.0.11 MySQL Community Server - GPL
    6.   
    7. Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
    8.   
    9. Oracle is a registered trademark of Oracle Corporation and/or its
    10. affiliates. Other names may be trademarks of their respective
    11. owners.
    12.   
    13. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    14.   
    15. mysql> show databases;
    16.  +--------------------+
    17.  | Database |
    18.  +--------------------+
    19.  | information_schema |
    20.  | mysql |
    21.  | performance_schema |
    22.  | sys |
    23.  +--------------------+
    24.   4 rows in set (0.01 sec)
    25.   
    26.  mysql> exit

  

猜你喜欢

转载自www.cnblogs.com/Jesse8/p/9298984.html
今日推荐