ubuntu yum源 安装mysql_yum安装mysql5.7

安装

官网下载仓库文件

点击图标,进入下载仓库界面

c66de0a45cf4d7fb81b8273fab150c2a.png

225e7e8990ce407ecf8fc523904aa31b.png

在linux下载该仓库

[root@VM_0_7_centos ~]# wget https://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

查看md5值,和官方进行对比

[root@VM_0_7_centos ~]# md5sum mysql80-community-release-el7-3.noarch.rpm

893b55d5d885df5c4d4cf7c4f2f6c153 mysql80-community-release-el7-3.noarch.rpm

安装仓库

[root@VM_0_7_centos ~]# rpm -ivh mysql80-community-release-el7-3.noarch.rpm

修改yum配置文件

将安装的repo文件中默认的8.0改为5.7生效

[mysql57-community]

name=MySQL 5.7 Community Server

baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/

enabled=1

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

[mysql80-community]

name=MySQL 8.0 Community Server

baseurl=http://repo.mysql.com/yum/mysql-8.0-community/el/7/$basearch/

enabled=0

gpgcheck=1

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

清除现有缓存

[root@VM_0_7_centos ~]# yum clean all

生成缓存,后续install时在缓存中搜索,提高速度

[root@VM_0_7_centos ~]# yum makecache

查看yum仓库关于mysql的所有仓库列表

[root@VM_0_7_centos ~]# yum list | grep mysql-com

mysql-community-client.i686 5.7.27-1.el7 mysql57-community

mysql-community-client.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-common.i686 5.7.27-1.el7 mysql57-community

mysql-community-common.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-devel.i686 5.7.27-1.el7 mysql57-community

mysql-community-devel.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-embedded.i686 5.7.27-1.el7 mysql57-community

mysql-community-embedded.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-embedded-compat.i686 5.7.27-1.el7 mysql57-community

mysql-community-embedded-compat.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-embedded-devel.i686 5.7.27-1.el7 mysql57-community

mysql-community-embedded-devel.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-libs.i686 5.7.27-1.el7 mysql57-community

mysql-community-libs.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-libs-compat.i686 5.7.27-1.el7 mysql57-community

mysql-community-libs-compat.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-release.noarch el7-5 mysql-connectors-community

mysql-community-server.x86_64 5.7.27-1.el7 mysql57-community

mysql-community-test.x86_64 5.7.27-1.el7 mysql57-community

安装其中的server版本,依赖会自动安装

[root@VM_0_7_centos ~]# yum -y install mysql-community-server.x86_64

启动

启动

第一次启动会初始化,生成数据库文件

[root@VM_0_7_centos ~]# systemctl start mysqld

[root@VM_0_7_centos ~]#

设置开机启动

[root@VM_0_7_centos ~]# systemctl enable mysqld

[root@VM_0_7_centos ~]#

查看默认密码

5.7之后的版本登录mysql是有默认密码的

[root@VM_0_7_centos ~]# grep "password" /var/log/mysqld.log

2019-09-20T12:35:39.605238Z 1 [Note] A temporary password is generated for root@localhost: 6HbfLn,_cC8a

登录

[root@VM_0_7_centos ~]# mysql -uroot -p'6HbfLn,_cC8a'

mysql: [Warning] Using a password on the command line interface can be insecure.

Welcome to the MySQL monitor. Commands end with ; or \g.

Your MySQL connection id is 3

Server version: 5.7.27

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>

运行安全向导,进行更改默认密码

[root@VM_0_7_centos mysql]# mysql_secure_installation

Enter password for user root: 输入默认密码

New password: 输入新密码

Re-enter new password: 确认新密码

Do you wish to continue with the password provided? ---- 是否继续使用提供的密码

Remove anonymous users? ---- 删除匿名用户

Disallow root login remotely? ---- 不允许远程root登陆

Remove test database and access to it? ---- 删除test测试数据库

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值