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时 ...
随机推荐
- C++程序--helloworld
#include<iostream>using namespace std; int main(){ cout << "hello world!" < ...
- HttpServletRequest 的常用属性说明
HttpServletRequest 的常用属性总是被窝遗忘,人老了记性就不好.所以做个笔记,方便以后查看. 测试地址:http://127.0.0.1:8080/Test/test getConte ...
- [Python ]小波变化库——Pywalvets 学习笔记
[Python ]小波变化库——Pywalvets 学习笔记 2017年03月20日 14:04:35 SNII_629 阅读数:24776 标签: python库pywavelets小波变换 更多 ...
- 主席树的妙用——Just h-index
题目传送门:https://ac.nowcoder.com/acm/contest/1107/C 题意:给出一个区间,求最大的 h ,使得区间内至少有 h 个数 大于等于 h. 思路:1.需要区间有序 ...
- 写excel文件-xlsxwriter包的使用
# encoding: utf8 from xlsxwriter.utility import xl_rowcol_to_cell import pandas as pd def df_to_exce ...
- A - Shortest path of the king (棋盘)
The king is left alone on the chessboard. In spite of this loneliness, he doesn't lose heart, becaus ...
- java笔记3-手写
关于类的一些笔记
- ICRA 2019最佳论文公布 李飞飞组的研究《Making Sense of Vision and Touch: Self-Supervised Learning of Multimodal Representations for Contact-Rich Tasks》获得了最佳论文
机器人领域顶级会议 ICRA 2019 正在加拿大蒙特利尔举行(当地时间 5 月 20 日-24 日),刚刚大会公布了最佳论文奖项,来自斯坦福大学李飞飞组的研究<Making Sense of ...
- Java final 关键字的用法以及原理(7)
/* final : 最终.作为一个修饰符, 1:可以修饰类,函数,变量. 2:被final修饰的类不可以被继承.为了避免被继承,被子类复写功能. 3:被final修饰的方法不可以被复写. 4:被fi ...
- hdu1066 Last non-zero Digit in N!(求阶乘最后一位不为0的数字)
http://acm.hdu.edu.cn/showproblem.php?pid=1066 转自:https://blog.csdn.net/fengyu0556/article/details/5 ...