centos7 国内镜像yum安装mysql5.7
我这里是采用纯净的系统,刚装的centos7,而且选择的最小安装所以基本上是什么环境都没有的,然后这篇文章主要针对于小白
检查mysql环境是否已存在
虽然我的是纯净系统,但别人的不能保证,为了避免发生什么问题我们还是先检查下mysql是否已经安装过
[root@localhost ~]# rpm -qa | grep mysql
[root@localhost ~]# rpm -qa |grep mariadb
mariadb-libs-5.5.64-1.el7.x86_64
我这里要卸载mariadb
[root@localhost ~]# yum remove mariadb-libs-5.5.64-1.el7.x86_64
假如你发现类似的就和我一样删除就好了
切换阿里云镜像源
先安装wget
[root@localhost ~]# yum install wget -y
然后下载阿里云yum源配置
[root@localhost ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
然后生成缓存
[root@localhost ~]# yum makecache
显视元数据缓存已建立就代表完成了
然后我们更新一下yum
[root@localhost ~]# yum update -y
这可能需要一点时间,耐心等待一下
下载国内的mysql rpm包并安装
地址为http://mirrors.ustc.edu.cn/mysql-ftp/Downloads
我这里直接通过下载地址下载
先是server包
[root@localhost ~]# wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-server-5.7.25-1.el7.x86_64.rpm
然后是client包
wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-client-5.7.25-1.el7.x86_64.rpm
还有common
[root@localhost ~]# wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-common-5.7.25-1.el7.x86_64.rpm
最后还有一个lib
[root@localhost ~]# wget http://mirrors.ustc.edu.cn/mysql-ftp/Downloads/MySQL-5.7/mysql-community-libs-5.7.25-1.el7.x86_64.rpm
在此之前我们还要先安装三个依赖环境
net-tools.x86_64,libaio.x86_64,perl.x86_64
我们直接使用yum安装
yum install -y perl.x86_64
yum install -y libaio.x86_64
yum install -y net-tools.x86_64
然后按照顺序安装mysql的依赖
[root@localhost ~]# rpm -ivh mysql-community-common-5.7.25-1.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh mysql-community-libs-5.7.25-1.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh mysql-community-client-5.7.25-1.el7.x86_64.rpm
[root@localhost ~]# rpm -ivh mysql-community-server-5.7.25-1.el7.x86_64.rpm
然后我们重启下mysql服务
[root@localhost ~]# service mysqld.service restart
我们查看下默认密码
[root@localhost etc]# grep 'temporary password' /var/log/mysqld.log
2020-02-11T09:49:32.224110Z 1 [Note] A temporary password is generated for root@localhost: E;#ySHlql0!>
我的密码为 E;#ySHlql0!>
[root@localhost mysql]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 5.7.25
Copyright (c) 2000, 2019, 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>
登录成功,接着改下密码和远程连接
修改密码并开启远程连接
修改密码
这里因为mysql的新版本限制了密码复杂度,所以我们需要设置一个稍微复杂的密码
mysql> set password=password('这里输入你想改的密码');
Query OK, 0 rows affected, 1 warning (0.00 sec)
密码需要包含数字和特殊符号,以及大写字母和小写字母
当然你设置完成以后可以就将密码限制关闭后在重新改密码,这里不过多演示
开启远程连接
打开mysql数据库
mysql> use mysql;
修改一条数据使其支持远程连接
mysql> update user set Host = '%' where Host = 'localhost' and User='root';
刷新系统权限相关表
mysql> flush privileges;
我们用navicat测一下
在此之前请确保防火墙开放了3306端口

我这里直接一次过了
关于开机自启,这种情况下mysql是自动启动的,不需要多余的配置
centos7 国内镜像yum安装mysql5.7的更多相关文章
- CentOS7.4使用yum安装MySQL5.6
CentOS默认数据库为mariadb可以使用yum安装MySQL5.6 系统版本查看 下载yum源安装 wget http://dev.mysql.com/get/mysql-community-r ...
- CentOS7 下使用YUM安装 MySQL5.7
于2015年10月19日(美国时间),Oracle公司发布了开源数据库MySQL的最新版本5.7.到现在已有将近3年之久,经过这几年的改进,MySQL5.7性能最高可达前一个版本的3倍,现在官网的最新 ...
- centos7.5下yum安装mysql-5.6.43
cd ~/ && cat /etc/redhat-release yum list installed |grep mysql #<===查看是否安装mysql,如果已经安装,使 ...
- centos7下用yum安装mysql5.7
1.安装mysql源 下载地址:http://dev.mysql.com/downloads/repo/yum/ 下载之后用yum安装:yum localinstall -y xx.noarch.rp ...
- CentOS7下使用YUM安装MySQL5.6
(1)检查系统中是否已安装 MySQL. rpm -qa | grep mysql 返回空值的话,就说明没有安装 MySQL . 注意:在新版本的CentOS7中,默认的数据库已更新为了Mariadb ...
- centos7下使用yum安装mysql5.7.10
原文地址:http://www.mamicode.com/info-detail-503994.html CentOS7的yum源中默认好像是没有mysql的.为了解决这个问题,我们要先下载mysql ...
- CentOS7.2通过Yum安装MySQL5.7
1 下载源 wget http://dev.mysql.com/get/mysql57-community-release-el7-8.noarch.rpm 2安装源 yum localinstall ...
- CentOS7 linux下yum安装mysql5.7
文章参考(https://www.cnblogs.com/jorzy/p/8455519.html) 1.创建存放安装包的位置,并且进入该目录 命令mkdir /share 命令cd /share 2 ...
- CentOS7.x使用yum安装Mysql5.6
先检查是否存在已安装的MySQL # yum list installed | grep mysql 若存在删除: yum remove 软件名称 CentOS 7的yum源中没有正常安装mysql时 ...
随机推荐
- 判断苹果和安卓端或者wp端
window.onload = function() { var u = navigator.userAgent; if(u.indexOf('Android') > -1 || u.index ...
- POJ 2362:Square 觉得这才算深度搜索
Square Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 21821 Accepted: 7624 Descripti ...
- Navicat Premium 12.0.18 安装与激活
Navicat Premium 12.0.18中文版 百度云链接:https://pan.baidu.com/s/1HHOOlQbbWAL-MlI908n4MQ 提取码:k9w6 1.下载好后双击运行 ...
- CentOS 7.3 下部署基于 Node.js的微信小程序商城
本文档为微信小程序商城NideShop项目的安装部署教程,欢迎star NideShop商城api服务:https://github.com/tumobi/nideshop NideShop微信小程序 ...
- UVA 10534 LCS变种题
求一个序列中 的2*n-1个数字 ,前n+1个数字为严格升序 后n+1个为严格降序,求最长的长度 一开始还没想清楚怎么解,其实就是一个LCS问题,从头到尾以及反序求一下LCS 由于 d[i]为包含了自 ...
- PAT Advanced 1099 Build A Binary Search Tree (30) [⼆叉查找树BST]
题目 A Binary Search Tree (BST) is recursively defined as a binary tree which has the following proper ...
- 使用py-faster-rcnn训练自己的数据集
https://www.jianshu.com/p/a672f702e596 本文记录了在ubuntu16.04下使用py-faster-rcnn来训练自己的数据集的大致过程. 在此之前,已经成功配置 ...
- Java--Excel操作
public static List<Info> readXml(String fileName, Map<String, Fuck> pcMap) throws Except ...
- 洛谷 P2871 [USACO07DEC]手链Charm Bracelet && 01背包模板
题目传送门 解题思路: 一维解01背包,突然发现博客里没有01背包的板子,补上 AC代码: #include<cstdio> #include<iostream> using ...
- tomcat配置配置文件和war包进行分离
应用部署 war包.配置文件分离 部署主机路径规划以及tomcat中间件改造 1.新建存放war包路径 /appsystems/apps 将war包放置其中 2.新建存放配置文件路径 /apps ...