博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CentOS7安装Mysql5.7
阅读量:6244 次
发布时间:2019-06-22

本文共 7259 字,大约阅读时间需要 24 分钟。

hot3.png

1. 查看是否有mariadb,有就删除掉,请自行了解mariadb。

[root@VM_195_230_centos upload]# rpm -qa|grep mariadb
mariadb-libs-5.5.50-1.el7_2.x86_64
[root@VM_195_230_centos upload]# rpm -e mariadb-libs-5.5.50-1.el7_2.x86_64 --nodeps
[root@VM_195_230_centos upload]# rpm -qa|grep mariadb
2. 下载mysql5.7,会花费一定时间。
[root@VM_195_230_centos upload]# wget http://dev.mysql.com/get/Downloads/MySQL-5.7/mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
......
2017-06-13 15:35:16 (1.08 MB/s) - 'mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar' saved [569978880/569978880]
3. 检看下载好的文件,并解压
[root@VM_195_230_centos upload]# ls 
mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
[root@VM_195_230_centos upload]# tar xvf mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar 
mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.16-1.el7.x86_64.rpm
mysql-community-libs-5.7.16-1.el7.x86_64.rpm
mysql-community-common-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-test-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.16-1.el7.x86_64.rpm
mysql-community-server-5.7.16-1.el7.x86_64.rpm
mysql-community-client-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-5.7.16-1.el7.x86_64.rpm
[root@VM_195_230_centos upload]# ls
mysql-5.7.16-1.el7.x86_64.rpm-bundle.tar
mysql-community-client-5.7.16-1.el7.x86_64.rpm
mysql-community-common-5.7.16-1.el7.x86_64.rpm
mysql-community-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-embedded-devel-5.7.16-1.el7.x86_64.rpm
mysql-community-libs-5.7.16-1.el7.x86_64.rpm
mysql-community-libs-compat-5.7.16-1.el7.x86_64.rpm
mysql-community-minimal-debuginfo-5.7.16-1.el7.x86_64.rpm
mysql-community-server-5.7.16-1.el7.x86_64.rpm
mysql-community-server-minimal-5.7.16-1.el7.x86_64.rpm
mysql-community-test-5.7.16-1.el7.x86_64.rpm
mysql57-community-release-el7-11.noarch.rpm
4. 安装mysql-community-common
[root@VM_195_230_centos upload]# sudo rpm -ivh mysql-community-common-5.7.16-1.el7.x86_64.rpm 
warning: mysql-community-common-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-common-5.7.16-1.e################################# [100%]
5. 安装mysql-community-libs
[root@VM_195_230_centos upload]# sudo rpm -ivh mysql-community-libs-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-libs-5.7.16-1.el7################################# [100%]
6. 安装mysql-community-client
[root@VM_195_230_centos upload]# sudo  rpm -ivh mysql-community-client-5.7.16-1.el7.x86_64.rpm 
warning: mysql-community-client-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-client-5.7.16-1.e################################# [100%]
7. 安装mysql-community-server,但是可能会出现错误,安装net-tools、libaio和numactl即可
[root@VM_195_230_centos upload]# sudo rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
[root@VM_195_230_centos upload]# sudo yum install net-tools
......
[root@VM_195_230_centos upload]# sudo yum install libaio
......
[root@VM_195_230_centos upload]# sudo rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
error: Failed dependencies:
        libnuma.so.1()(64bit) is needed by mysql-community-server-5.7.16-1.el7.x86_64
[root@VM_195_230_centos upload]# sudo yum install numactl
......
[root@VM_195_230_centos upload]# sudo rpm -ivh mysql-community-server-5.7.16-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.16-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing...                          ################################# [100%]
Updating / installing...
   1:mysql-community-server-5.7.16-1.e################################# [100%]
8. 运行mysqld,并查看其进程
[root@VM_195_230_centos upload]# mysqld 
2017-06-13T07:39:52.430464Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-13T07:39:52.432444Z 0 [Note] mysqld (mysqld 5.7.16) starting as process 31404 ...
2017-06-13T07:39:52.435516Z 0 [ERROR] Fatal error: Please read "Security" section of the manual to find out how to run mysqld as root!

2017-06-13T07:39:52.435545Z 0 [ERROR] Aborting

2017-06-13T07:39:52.435562Z 0 [Note] Binlog end

2017-06-13T07:39:52.435759Z 0 [Note] mysqld: Shutdown complete

[root@VM_195_230_centos upload]# ps -ef | grep mysqld

root     31455 29805  0 15:40 pts/0    00:00:00 grep --color=auto mysqld
9. 初始化mysql数据
[root@VM_195_230_centos upload]# mysqld --initialize --user=mysql
10. 查看自动生成的密码,在/var/log/mysqld.log文件的最后
[root@VM_195_230_centos upload]# cat /var/log/mysqld.log
2017-06-13T07:40:13.944867Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2017-06-13T07:40:14.337013Z 0 [Warning] InnoDB: New log files created, LSN=45790
2017-06-13T07:40:14.434155Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2017-06-13T07:40:14.492185Z 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: 89cddc6c-500b-11e7-af19-525400cfcfdb.
2017-06-13T07:40:14.493954Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2017-06-13T07:40:14.494419Z 1 [Note] A temporary password is generated for root@localhost: HuWi7aT#fAUO
11. 启动mysqld
[root@VM_195_230_centos upload]#  systemctl start mysqld.service
12. 登录mysql,注意不能粘贴密码,需要手动输入
[root@VM_195_230_centos upload]# mysql -uroot -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.16

Copyright (c) 2000, 2016, 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.

13. 查看数据库,系统提示要修改密码

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 'qwerasdf1234';
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)

14. 完成。

PS:资源来源于互联网,自己只提取并整理出了核心的东西。

 

转载于:https://my.oschina.net/valuetodays/blog/1559648

你可能感兴趣的文章
阿里云创建E-MapReduce 2 创建集群
查看>>
白帽子认为2017年网络安全的头号威胁是大规模监控
查看>>
前端JS如何获取主域名(根域名)
查看>>
VR技术行业应用前景初探:技术创新定义精彩未来
查看>>
知识产权攻击是从哪冒出来的?
查看>>
宽带服务商设局,美国法律这么治
查看>>
混合IT架构的最佳实践
查看>>
一文详解神经网络 BP 算法原理及 Python 实现
查看>>
高通与联想达成新专利许可协议
查看>>
阿里科学家王刚、吴翰清同时入选MIT2017年度TR35 开创中国互联网企业先河
查看>>
继SDS之后又迎来CDM,存储行业真要变天了?
查看>>
美媒:联想电脑威胁五角大楼网络安全
查看>>
绿色智慧城市|城市增长边界的几个误区
查看>>
美国土安全部发警告:尽快卸载QuickTime for Windows
查看>>
《SEO的艺术(原书第2版)》——3.9 为客户挖掘和直接营销开展SEO
查看>>
运营商造梦“管道+内容”三十载不言放弃
查看>>
《 自动化测试最佳实践:来自全球的经典自动化测试案例解析》一一3.1 本案例研究的背景...
查看>>
哈工大在CoNLL上斩获全球第四,车万翔博士详解背后的技术细节
查看>>
阿里钉钉VS企业微信 谁才是企业级一哥?
查看>>
2015-2020智慧城市物联网市场复合年增长率达23.2%
查看>>