阿里云ECS下基于Centos7.4安装MySQL5.7.20
1、首先登录阿里云ECS服务器,如下图所示:
2、卸载MariaDB
说明:CentOS7.x默认安装MariaDB而不是MySQL,而且yum服务器上也移除了MySQL相关的软件包。因为MariaDB和MySQL可能会冲突,故先卸载MariaDB!
3、到mysql的官网下载最新版mysql的rpm集合包。
URL如下:https://downloads.mysql.com/archives/community/
4、进入/usr/local/src目录,使用lrzsz中的rz工具进行上传。
或者直接使用linux 下的wget工具进行下载:wget https://cdn.mysql.com/archives/mysql-5.7/mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar(如果没有wget工具,使用yum install -y wget进行安装)
5、上传mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar到Linux服务器,并解压tar包。
6、使用rpm -ivh命令进行安装。
安装过程中缺少依赖包libaio,使用 yum install -y libaio 进行安装。
再次使用rpm -ivh 安装
6、上面几个包有依赖关系,执行有先后顺序。
使用rpm安装方式安装mysql,安装的路径如下:
a. 数据库目录
/var/lib/mysql/
b. 配置文件
/usr/share/mysql(mysql.server命令及配置文件)
c. 相关命令
/usr/bin(mysqladmin mysqldump等命令)
d. 启动脚本
/etc/rc.d/init.d/(启动脚本文件mysql的目录)
e. /etc/my.conf(mysql数据库配置文件)
Xshell 5 (Build 1326)
Copyright (c) 2002-2017 NetSarang Computer, Inc. All rights reserved. Type `help' to learn how to use Xshell prompt.
[c:\~]$ Connecting to 47.95.234.20:22...
Connection established.
To escape to local shell, press 'Ctrl+Alt+]'. Last login: Mon Feb 19 10:27:46 2018 from 114.240.255.235 Welcome to Alibaba Cloud Elastic Compute Service ! [root@iZqmo9i3j77p7eZ ~]# cat /etc/redhat-release
CentOS Linux release 7.4.1708 (Core)
[root@iZqmo9i3j77p7eZ ~]# uname -a
Linux iZqmo9i3j77p7eZ 3.10.0-693.2.2.el7.x86_64 #1 SMP Tue Sep 12 22:26:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@iZqmo9i3j77p7eZ ~]# rpm -qa | grep -i mariadb
mariadb-libs-5.5.56-2.el7.x86_64
[root@iZqmo9i3j77p7eZ ~]# rpm -e --nodeps mariadb-libs-5.5.56-2.el7.x86_64
[root@iZqmo9i3j77p7eZ ~]# rpm -qa | grep -i mariadb
[root@iZqmo9i3j77p7eZ ~]# cd /usr/local/src/
[root@iZqmo9i3j77p7eZ src]# yum install -y lrzsz
Loaded plugins: fastestmirror
base | 3.6 kB 00:00
epel | 4.7 kB 00:00
extras | 3.4 kB 00:00
mysql57-community | 2.5 kB 00:00
nginx | 2.9 kB 00:00
updates | 3.4 kB 00:00
(1/3): epel/x86_64/updateinfo | 882 kB 00:00
(2/3): epel/x86_64/primary_db | 6.2 MB 00:00
(3/3): mysql57-community/x86_64/primary_db | 134 kB 00:00
Determining fastest mirrors
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package lrzsz-0.12.20-36.el7.x86_64 already installed and latest version
Nothing to do
[root@iZqmo9i3j77p7eZ src]# cd /usr/local/src/
[root@iZqmo9i3j77p7eZ src]# yum install -y lrzsz
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Package lrzsz-0.12.20-36.el7.x86_64 already installed and latest version
Nothing to do
[root@iZqmo9i3j77p7eZ src]# rz -y
[root@iZqmo9i3j77p7eZ ~]# ls
mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar
[root@iZqmo9i3j77p7eZ ~]# tar xf mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar -C /root/
[root@iZqmo9i3j77p7eZ ~]# ll
total 1158760
-rw-r--r-- 1 root root 593274880 Sep 14 23:52 mysql-5.7.20-1.el7.x86_64.rpm-bundle.tar
-rw-r--r-- 1 7155 31415 25090196 Sep 14 23:44 mysql-community-client-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 278300 Sep 14 23:44 mysql-community-common-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 3778120 Sep 14 23:44 mysql-community-devel-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 46238924 Sep 14 23:44 mysql-community-embedded-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 24077232 Sep 14 23:44 mysql-community-embedded-compat-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 128440800 Sep 14 23:44 mysql-community-embedded-devel-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2238604 Sep 14 23:44 mysql-community-libs-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 2115892 Sep 14 23:44 mysql-community-libs-compat-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 55538708 Sep 14 23:44 mysql-community-minimal-debuginfo-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 171597916 Sep 14 23:45 mysql-community-server-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 15256460 Sep 14 23:45 mysql-community-server-minimal-5.7.20-1.el7.x86_64.rpm
-rw-r--r-- 1 7155 31415 118609776 Sep 14 23:45 mysql-community-test-5.7.20-1.el7.x86_64.rpm
[root@iZqmo9i3j77p7eZ ~]# rpm -ivh mysql-community-common-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-common-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-common-5.7.20-1.e################################# [100%]
[root@iZqmo9i3j77p7eZ ~]# rpm -ivh mysql-community-libs-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-libs-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-libs-5.7.20-1.el7################################# [100%]
[root@iZqmo9i3j77p7eZ ~]# rpm -ivh mysql-community-client-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-client-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-client-5.7.20-1.e################################# [100%]
[root@iZqmo9i3j77p7eZ ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.20-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-5.7.20-1.el7.x86_64
libaio.so.1(LIBAIO_0.1)(64bit) is needed by mysql-community-server-5.7.20-1.el7.x86_64
libaio.so.1(LIBAIO_0.4)(64bit) is needed by mysql-community-server-5.7.20-1.el7.x86_64
[root@iZqmo9i3j77p7eZ ~]# yum install -y libaio
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* epel: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
Resolving Dependencies
--> Running transaction check
---> Package libaio.x86_64 0:0.3.109-13.el7 will be installed
--> Finished Dependency Resolution Dependencies Resolved =============================================================================================================
Package Arch Version Repository Size
=============================================================================================================
Installing:
libaio x86_64 0.3.109-13.el7 base 24 k Transaction Summary
=============================================================================================================
Install 1 Package Total download size: 24 k
Installed size: 38 k
Downloading packages:
libaio-0.3.109-13.el7.x86_64.rpm | 24 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Warning: RPMDB altered outside of yum.
** Found 2 pre-existing rpmdb problem(s), 'yum check' output follows:
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18()(64bit)
2:postfix-2.10.1-6.el7.x86_64 has missing requires of libmysqlclient.so.18(libmysqlclient_18)(64bit)
Installing : libaio-0.3.109-13.el7.x86_64 1/1
Verifying : libaio-0.3.109-13.el7.x86_64 1/1 Installed:
libaio.x86_64 0:0.3.109-13.el7 Complete!
[root@iZqmo9i3j77p7eZ ~]# rpm -ivh mysql-community-server-5.7.20-1.el7.x86_64.rpm
warning: mysql-community-server-5.7.20-1.el7.x86_64.rpm: Header V3 DSA/SHA1 Signature, key ID 5072e1f5: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:mysql-community-server-5.7.20-1.e################################# [100%]
[root@iZqmo9i3j77p7eZ ~]# cat /etc/passwd|grep mysql
mysql:x:27:27:MySQL Server:/var/lib/mysql:/bin/false
[root@iZqmo9i3j77p7eZ ~]# mysqld --initialize --user=mysql
[root@iZqmo9i3j77p7eZ ~]# cat /var/log/mysqld.log
2018-02-19T03:15:04.391013Z 0 [Warning] TIMESTAMP with implicit DEFAULT value is deprecated. Please use --explicit_defaults_for_timestamp server option (see documentation for more details).
2018-02-19T03:15:06.462877Z 0 [Warning] InnoDB: New log files created, LSN=45790
2018-02-19T03:15:06.788535Z 0 [Warning] InnoDB: Creating foreign key constraint system tables.
2018-02-19T03:15:06.852414Z 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: 15cbe9f9-1523-11e8-ac67-00163e08bafc.
2018-02-19T03:15:06.854816Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2018-02-19T03:15:06.855447Z 1 [Note] A temporary password is generated for root@localhost: monb3&s#kXfC#此处为MySQL生成的随机密码。
[root@iZqmo9i3j77p7eZ ~]# systemctl start mysqld.service
[root@iZqmo9i3j77p7eZ ~]# netstat -lntup|grep mysql
tcp6 0 0 :::3306 :::* LISTEN 8124/mysqld
[root@iZqmo9i3j77p7eZ ~]# ps -aux|grep mysql
mysql 8124 1.2 9.0 1125360 171300 ? Sl 11:16 0:00 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
root 8158 0.0 0.0 112660 972 pts/1 R+ 11:16 0:00 grep --color=auto mysql
[root@iZqmo9i3j77p7eZ ~]# mysql -u root -h localhost -P 3306 -p#登录MySQL
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.7.20 Copyright (c) 2000, 2017, 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> set password = password('123456');#设置密码
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> grant all privileges on *.* to 'root'@'%' identified by '123456';#授权远程访问连接MySQL
Query OK, 0 rows affected, 1 warning (0.01 sec)
mysql> flush privileges;#将操作即时生效
Query OK, 0 rows affected (0.00 sec)
mysql> quit;
Bye
[root@iZqmo9i3j77p7eZ ~]# systemctl enable mysqld.service#加入开机自启动
阿里云ECS下基于Centos7.4安装MySQL5.7.20的更多相关文章
- [转]阿里云CentOS 7.1使用yum安装MySql5.6.24
阿里云CentOS 7.1使用yum安装MySql5.6.24 作者:vfhky | 时间:2015-06-25 09:43 | 分类:web 在前面两篇文章<2015博客升级记(四):Cent ...
- 解决阿里云ECS下kubeadm部署k8s无法指定公网IP
背景 一般情况下,"kubeadm"部署集群时指定"--apiserver-advertise-address=<public_ip>"参数,即可在 ...
- 阿里云ECS服务器(G5)安装配置docker
镜像下载.域名解析.时间同步请点击 阿里云开源镜像站 前言 服务器配置:阿里云ECS服务器(G5服务器3年2核8G内存80G云盘),安装的是CentOS,内核信息:5.10.60-9.al8.x86_ ...
- 阿里云ECS服务器上搭建keepalived+mha+mysql5.6+gtid+一主两从+脚本判断架构踩的坑
最近,公司项目搭建了一套后端数据库架构,不是在RDS,是在阿里云的ECS服务器上搭建keepalived.mha.mysql5.6.gtid.一主两从架构,目前还没有实现读写分离,以后架构升级,可能代 ...
- CentOS6.5和RedHat6.5下以rpm方式安装mysql-5.6.20
转帖;http://blog.csdn.net/mw08091020/article/details/39234207 a.检查下linux是不是已经安装了mysql rpm -qa | grep - ...
- 阿里云ECS下CentOS7.4 yum安装Python3.6环境
一.安装EPEL和IUS软件源 二.安装Python3.6 三.创建python3软链接连接符 四.安装pip3 五.创建pip3链接符 六.进行验证是否安装成功 一.安装EPEL和IUS软件源 yu ...
- 基于阿里云ecs(centos 7) 安装jenkins
1. 安装好 jdk 2. 官网(https://pkg.jenkins.io/redhat-stable/)下载rpm包(稳定版): wget https://pkg.jenkins.io/redh ...
- 阿里云ECS下Ubuntu 16.04系统安装python3.6.5 环境并设置为默认
一.添加python3.6安装包并安装: 二.修改系统默认python版本为3.6: 三.安装并升级pip版本: 一.添加python3.6安装包并安装: sudo apt-get install s ...
- 阿里云CentOS 7.1使用yum安装MySql5.6.24
正确的安装方法: 众所周知,Linux系统自带的repo是不会自动更新每个软件的最新版本(基本都是比较靠后的稳定版),所以无法通过yum方式安装MySQL的高级版本.所以我们需要先安装带有当前可用的m ...
随机推荐
- 【洛谷P1774】最接近神的人
最接近神的人_NOI导刊2010提高(02) 用类似于桶的方法,树状数组记录原序列的某位置之前已经插入了多少个数, 插入时树状数组单点加1即可 先排一遍序,从大到小插入所有数在原序列的位置, 统计每次 ...
- 【luogu P3375 KMP字符串匹配】 模板
题目链接:https://www.luogu.org/problemnew/show/P3375 精华:在每次失配后不从头匹配而是尝试找一个新的开始并且是新开始的位置最长的相同前缀和后缀. 实际上KM ...
- Mysql之inner join,left join,right join详解
首先借用官方的解释下: inner join(等值连接):只返回两个表中联结字段相等的行: left join(左联接):返回包括左表中的所有记录和右表中联结字段相等的记录: right join(右 ...
- JavaScript:对事件的反应
<!DOCTYPE html><html><head><meta http-equiv="Content-Type" content=&q ...
- 触发器 :new和 :old的使用
:new --为一个引用最新的列值;:old --为一个引用以前的列值; 这两个变量只有在使用了关键字 "FOR EACH ROW"时才存在,且update语句两个都有,而inse ...
- 浅谈箭头函数和setTimeout中的this
箭头函数会改变this的指向,这个大家看文档都看到过,可是有没有具体理解呢?我发现自己应该可能大概是......emmmm,然后我整理了一遍,加强一下概念吧顺带再讲一下setTimeout这个函数改写 ...
- 让微信内置浏览器兼容clipboard.js 复制粘贴 ios 安卓
<!--js copy事件--><script type="text/javascript" src="/static/js/clipboard.min ...
- mysql——查询重复数据,及删除重复数据只保留一条数据
查询 text 表中,user_name字段值重复的数据及重复次数 select user_name,count(*) as count from text 删除 text 表中,重复出现的数据只保留 ...
- Apache httpd Server 配置正向代理
背景 代理(Proxy),位于客户端与实际服务端之间,当客户端需要请求服务端内容时,先向代理发起请求,代理将请求转发到实际的服务器,再原路返回.也可以在代理服务器设置缓存,将实际服务器上不常变化的内容 ...
- (转)老生常谈-从输入url到页面展示到底发生了什么
刚开始写这篇文章还是挺纠结的,因为网上搜索"从输入url到页面展示到底发生了什么",你可以搜到一大堆的资料.而且面试这道题基本是必考题,二月份面试的时候,虽然知道这个过程发生了什么 ...