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时 ...
随机推荐
- 05 GUI UGUI
在Unity开发过程中,不论是3D还是2D开发都需要大量的UI界面来配合使用,用来达到更好的效果 GUI:在Unity脚本生命周期回调方法OnGUI中实现,每一帧渲染两次,在OnGUI中的GUI界面元 ...
- 吴裕雄--天生自然TensorFlow2教程:张量限幅
import tensorflow as tf a = tf.range(10) a # a中小于2的元素值为2 tf.maximum(a, 2) # a中大于8的元素值为8 tf.minimum(a ...
- POJ 1745:Divisibility 枚举某一状态的DP
Divisibility Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 11001 Accepted: 3933 Des ...
- python的debug神器PySnooper
同事给我推荐了这个调试神器,一直没工夫看,今天看了下. 原文链接: 史上最方便的Python Debug工具|腾讯技术说 体验了下,感觉最好的用法:1.优先逐行调试:2.一些复杂状态处理或者偶现的bu ...
- hdu1312题解
这道题从名称来看看不出什么. 所以我们先读一下题干 There is a rectangular room, covered with square tiles. Each tile is color ...
- Mac电脑如何彻底删除node
之前本来想搭建一个hexo来写博客的,但是最后还是放弃,老老实实就在博客园和CSDN写博文了,这里记录一下怎么在Mac电脑下彻底删除node.js的方法 下面这个方法是我结合了网上好几个方法综合在一起 ...
- UVA 11732 链表+字典树
因为字符集比较大,所以就不能用简单字典树,在字典树里面,用链表进行存储.这个倒是不难,练了下手 统计的时候还是有点难搞,因为要算所有的两两比较的次数之和,对分叉处进行计算,注意细节 #include ...
- css选择器,选择指定属性的值
选择属性为href的值: <a class='test' href='www.baidu.com' >test</a> response.css('.test::attr(hr ...
- Unity使用TUIO协议接入雷达
本篇文章不介绍Unity.TUIO.雷达是什么以及有什么作用.刚接触TUIO的亲们,建议直接硬刚.至于刚接触Unity的亲,这边建议亲直接放弃治疗呢 下面开始正儿八经的教程 需要准备的东西 Unity ...
- sudo: /etc/sudoers is mode 0777, should be 0440 单用户 sudo不用输入密码的方法
sudo权限问题考察一题 su - sudo su - sudo su - test [root@localhost ~]# su - zzx #root用户进行切换不需要输入密码 [ ...