阿里云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 ...
随机推荐
- Android学习笔记_46_Android的intent之间Object、List、List<Object>和全局变量数据的传递(Parcelable Serializable)
转http://blog.csdn.net/pku_android/article/details/7456305 一.传递List<String>和List<Integer> ...
- 总结的MR中连接操作
1 reduce side join在map端加上标记, 在reduce容器保存,然后作笛卡尔积缺点: 有可能oom 2 map side join 2.1 利用内存和分布式缓存,也有oom风险 2 ...
- 优雅的QSignleton (二) MonoSingleton单例实现
MonoSingleton.cs namespace QFramework.Example { using System.Collections; using UnityEngine; class C ...
- Vscode配置C++运行环境(2019/1//11更)并加入bits/stdc++.h头文件
因为重装系统,以前配置好的c++环境又没了.所以有要配置一遍. 1 下载mingw64或minw, 配置好环境变量:C://mingw64//bin; 在cmd下用g++ -v验证是否成功. 2. ...
- 搭建两个节点的大数据集群-1.hdfs集群
0.规划 两个节点: ip 部署的程序 备注 192.168.56.2/bigdata.lzf namenode,datanode,NodeManager,hive,presto,mysql, ...
- mybatis笔记之一次插入多条数据sql语句写法
<insert id="insertList" parameterType="java.util.List"> insert into balanc ...
- Co. - Microsoft - Windows - 通过任务计划,备份本地MySQL,数据上传Linux备份服务器
需求 客户为Windows系统,安装MySQL,需要每日备份数据库到指定目录,并且上传到公司的备份服务器(Linux). 1.使用mysqldump备份MySQL数据库,使用FTP上传到阿里云Linu ...
- vue.js 组件-全局组件和局部组件
这两天学习了Vue.js 感觉组件这个地方知识点挺多的,而且很重要,所以,今天添加一点小笔记. 首先Vue组件的使用有3个步骤,创建组件构造器,注册组件,使用组件3个方面. 代码演示如下: <! ...
- jsonp 跨域只能调用一次ajax(无法多次调用或者循环调用)
jsonp 跨域只能掉用一次ajax(无法多次调用或者循环调用) 百度搜索关键字:jsonp 只能调用一次ajax 解决方法 //回调函数设置,给后台执行 window[callback ...
- 发送post请求几种常见content-type类型
application/x-www-form-urlencoded 这应该是最常见的 POST 提交数据的方式了.浏览器的原生 form 表单,如果不设置 enctype 属性,那么最终就会以 app ...