centos7.5安装mysql5.7.24-bundle包和centos6.5安装mysql-5.7.24bundle包

记录两次安装mysql的操作:

一、centos7.5安装mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar包

官网下载页面:https://dev.mysql.com/downloads/file/?id=481064

官网下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar

[root@localhost ~]# rpm -qa|grep mariadb
mariadb-libs-5.5.56-2.el7.x86_64

[root@localhost ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64

[root@localhost ~]# rm /etc/my.cnf
rm:是否删除普通空文件 "/etc/my.cnf"?y

[root@localhost ~]# groupadd mysql
[root@localhost ~]# useradd -g mysql mysql

[root@localhost ~]# cd /usr/local/

[root@localhost local]# tar -xvf mysql-5.7.24-1.el7.x86_64.rpm-bundle.tar 
mysql-community-common-5.7.24-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.24-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.24-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.24-1.el7.x86_64.rpm
mysql-community-embedded-5.7.24-1.el7.x86_64.rpm
mysql-community-libs-5.7.24-1.el7.x86_64.rpm
mysql-community-devel-5.7.24-1.el7.x86_64.rpm
mysql-community-server-5.7.24-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.24-1.el7.x86_64.rpm
mysql-community-client-5.7.24-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.24-1.el7.x86_64.rpm
mysql-community-test-5.7.24-1.el7.x86_64.rpm

[root@localhost local]# rpm -ivh mysql-community-common-5.7.24-1.el7.x86_64.rpm 

[root@localhost local]# rpm -ivh mysql-community-libs-5.7.24-1.el7.x86_64.rpm 

[root@localhost local]# rpm -ivh mysql-community-client-5.7.24-1.el7.x86_64.rpm 

[root@localhost local]# rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm 
警告:mysql-community-server-5.7.24-1.el7.x86_64.rpm: 头V3 DSA/SHA1 Signature, 密钥 ID 5072e1f5: NOKEY
错误:依赖检测失败:
    net-tools 被 mysql-community-server-5.7.24-1.el7.x86_64 需要

[root@localhost local]# yum install net-tools

[root@localhost local]# rpm -ivh mysql-community-server-5.7.24-1.el7.x86_64.rpm 

[root@localhost local]# mysqld --initialize --user=mysql
[root@localhost local]# cat /var/log/mysqld.log
2018-11-12T02:18:17.411078Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-11-12T02:18:18.906585Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-11-12T02:18:18.978530Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-11-12T02:18:19.070813Z 0 [Warning] No existing UUID has been found, so we assume that this is the first time that this server has been started. Generating a new UUID: 387b3400-e621-11e8-8a32-000c292991c8.
2018-11-12T02:18:19.072785Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-11-12T02:18:19.074971Z 1 [Note] A temporary password is generated for root@localhost: oa=rtAkAC9l2
[root@localhost local]# systemctl start mysqld.service
[root@localhost local]# mysql -uroot -p
Enter password: 

(!!!注意:此处密码填写上面命令最后的显示内容:oa=rtAkAC9l2)
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.7.24

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;
ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement.
mysql> ALTER USER 'root'@'localhost' IDENTIFIED BY '1234';
Query OK, 0 rows affected (0.00 sec)

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
4 rows in set (0.00 sec)

二、centos6.5安装mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar包

官网下载页面:https://dev.mysql.com/downloads/file/?id=481078

官网下载地址:https://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar

[root@SHELL ~]# groupadd mysql
[root@SHELL ~]# useradd -r -g mysql -s /bin/false mysql
[root@SHELL ~]# rpm -qa | grep mysql
mysql-libs-5.1.71-1.el6.x86_64
[root@SHELL ~]# rpm -e --nodeps mysql-libs-5.1.71-1.el6.x86_64

[root@SHELL local]# tar -xvf mysql-5.7.24-1.el6.x86_64.rpm-bundle.tar 
mysql-community-test-5.7.24-1.el6.x86_64.rpm
mysql-community-client-5.7.24-1.el6.x86_64.rpm
mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm
mysql-community-libs-5.7.24-1.el6.x86_64.rpm
mysql-community-server-5.7.24-1.el6.x86_64.rpm
mysql-community-devel-5.7.24-1.el6.x86_64.rpm
mysql-community-embedded-5.7.24-1.el6.x86_64.rpm
mysql-community-embedded-devel-5.7.24-1.el6.x86_64.rpm
mysql-community-common-5.7.24-1.el6.x86_64.rpm

[root@SHELL local]# rpm -ivh mysql-community-common-5.7.24-1.el6.x86_64.rpm 

[root@SHELL local]# rpm -ivh mysql-community-libs-5.7.24-1.el6.x86_64.rpm 

[root@SHELL local]# rpm -ivh mysql-community-libs-compat-5.7.24-1.el6.x86_64.rpm 

[root@SHELL local]# rpm -ivh mysql-community-client-5.7.24-1.el6.x86_64.rpm

[root@SHELL local]# rpm -ivh mysql-community-server-5.7.24-1.el6.x86_64.rpm 
warning: mysql-community-server-5.7.24-1.el6.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-5.7.24-1.el6.x86_64
    libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.24-1.el6.x86_64
    libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.24-1.el6.x86_64
    libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.24-1.el6.x86_64
    libnuma.so.1(libnuma_1.1)(64bit) is needed by mysql-community-server-5.7.24-1.el6.x86_64
    libnuma.so.1(libnuma_1.2)(64bit) is needed by mysql-community-server-5.7.24-1.el6.x86_64

[root@SHELL local]# yum install numactl

[root@SHELL local]# yum install libaio

[root@SHELL local]# rpm -ivh mysql-community-server-5.7.24-1.el6.x86_64.rpm 

[root@SHELL local]# service mysqld start

[root@SHELL local]# grep 'temporary password' /var/log/mysqld.log
2018-11-13T01:25:45.685440Z 1 [Note] A temporary password is generated for root@localhost: U(*RO<>*c695

[root@SHELL local]# mysql -uroot -p
Enter password: 

mysql> alter user 'root'@'localhost' identified by '1234';
Query OK, 0 rows affected (0.00 sec)

mysql> exit;

关闭防火墙或开启3306端口

[root@SHELL local]# /sbin/iptables -I INPUT -p tcp --dport 3306 -j ACCEPT
[root@SHELL local]# /etc/rc.d/init.d/iptables save
iptables:将防火墙规则保存到 /etc/sysconfig/iptables:     [确定]
[root@SHELL local]# /etc/init.d/iptables restart
iptables:将链设置为政策 ACCEPT:filter                    [确定]
iptables:清除防火墙规则:                                 [确定]
iptables:正在卸载模块:                                   [确定]
iptables:应用防火墙规则:                                 [确定]
[root@SHELL local]# service iptables status
表格:filter
Chain INPUT (policy ACCEPT)
num  target     prot opt source               destination         
1    ACCEPT     tcp  --  0.0.0.0/0            0.0.0.0/0           tcp dpt:3306 

你可能感兴趣的:(centos7.5安装mysql5.7.24-bundle包和centos6.5安装mysql-5.7.24bundle包)