一、通过Yum命令安装

1.下载rpm安装源

官方地址:https://dev.mysql.com/downloads/repo/yum/

rpm文件地址:https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

1)通过wget命令下载文件

[root@localhost ~]# wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
---- ::-- https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
正在解析主机 dev.mysql.com (dev.mysql.com)... 137.254.60.11
正在连接 dev.mysql.com (dev.mysql.com)|137.254.60.11|:... 已连接。
已发出 HTTP 请求,正在等待回应... Found
位置:https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm [跟随至新的 URL]
---- ::-- https://repo.mysql.com//mysql57-community-release-el7-11.noarch.rpm
正在解析主机 repo.mysql.com (repo.mysql.com)... 23.1.165.122
正在连接 repo.mysql.com (repo.mysql.com)|23.1.165.122|:... 已连接。
已发出 HTTP 请求,正在等待回应... OK
长度: (25K) [application/x-redhat-package-manager]
正在保存至: “mysql57-community-release-el7-.noarch.rpm” %[==================================================================================================================================================================================================>] , --.-K/s 用时 .1s -- :: ( KB/s) - 已保存 “mysql57-community-release-el7-.noarch.rpm” [/]) [root@localhost ~]#

2.安装Mysql

1)安装Mysql源文件

yum localinstall -y mysql57-community-release-el7-11.noarch.rpm

2)查看Mysql源是否安装成功

[root@localhost ~]# yum repolist enabled | grep "mysql.*-community.*"
mysql-connectors-community/x86_64 MySQL Connectors Community
mysql-tools-community/x86_64 MySQL Tools Community
mysql57-community/x86_64 MySQL 5.7 Community Server
[root@localhost ~]#

3)安装Mysql服务

yum install -y mysql-community-server

4)查看Mysql服务是否安装成功

[root@localhost ~]# systemctl status mysqld
● mysqld.service - MySQL Server
Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled; vendor preset: disabled)
Active: inactive (dead)
Docs: man:mysqld()
http://dev.mysql.com/doc/refman/en/using-systemd.html
[root@localhost ~]#

3.启动Mysql

systemctl start mysqld

4.修改root登录密码

1)获取root默认密码(由于Mysql安全策略升级,安装完成后系统自动设置了一个随机密码)

[root@localhost ~]# grep 'temporary password' /var/log/mysqld.log
--08T09::.780623Z [Note] A temporary password is generated for root@localhost: auw;Nj7J!j/J
[root@localhost ~]#

2)登录Mysql

[root@localhost ~]# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is
Server version: 5.7. Copyright (c) , , 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>

3)修改密码

3.1)由于Mysql默认要求设置密码复杂度高(必须包含 大小写字母、数字、符号)

mysql> alter user 'root'@'localhost' identified by '';
ERROR (HY000): Your password does not satisfy the current policy requirements
mysql>

这样设置是合法的:

mysql> alter user 'root'@'localhost' identified by 'Mysql666!';
Query OK, rows affected (0.00 sec) mysql>

3.2)关闭Mysql密码校验规则,允许设置简单密码

3.2.1)在Mysql配置文件最后加入:validate_password = off

[root@localhost ~]# vi /etc/my.cnf
# For advice on how to change settings please see
# http://dev.mysql.com/doc/refman/5.7/en/server-configuration-defaults.html [mysqld]
#
# Remove leading # and set to the amount of RAM for the most important data
# cache in MySQL. Start at % of total RAM for dedicated server, else %.
# innodb_buffer_pool_size = 128M
#
# Remove leading # to turn on a very important data integrity option: logging
# changes to the binary log between backups.
# log_bin
#
# Remove leading # to set options mainly useful for reporting servers.
# The server defaults are faster for transactions and fast SELECTs.
# Adjust sizes as needed, experiment to find the optimal values.
# join_buffer_size = 128M
# sort_buffer_size = 2M
# read_rnd_buffer_size = 2M
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links= log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid validate_password = off

3.2.2)重启Mysql服务生效

systemctl restart mysqld

4)设置简单密码 :)

mysql> alter user 'root'@'localhost' identified by '';
Query OK, rows affected (0.00 sec) mysql>

5.配置远程用户登录

1)指定Ip

mysql> grant all privileges on *.* to 'root'@'192.168.1.1' identified by '' with grant option;
Query OK, rows affected, warning (0.00 sec) mysql>

2)允许所有

mysql> grant all privileges on *.* to 'root'@'%' identified by '' with grant option;
Query OK, rows affected, warning (0.00 sec) mysql>

6.设置开机启动

systemctl enable mysqld

systemctl daemon-reload

7.其他

1)已配置远程访问权限,依然不能登录?请检查系统是否开启了防火墙。

1.1)CentOS关闭防火墙

systemctl stop firewalld.service

1.2)禁止防火墙开机启动

systemctl disable firewalld.service

2)Mysql客户端软件(推荐)

2.1)SQLyog(官网:https://sqlyog.en.softonic.com/)

2.2)Navicat(官网:https://www.navicat.com/en/)

CentOS在线安装Mysql5.7的更多相关文章

  1. CentOS 通过yum在线安装MySQL5.7

    CentOS 通过yum在线安装MySQL5.7 Step1: 检测系统是否自带安装mysql # yum list installed | grep mysql Step2: 删除系统自带的mysq ...

  2. centos在线安装svn

    centos在线安装svn 用下列命令安装svn服务 yum install subversion 创建svn版本库目录 mkdir -p /var/svn/svnrepos 创建版本库 svnadm ...

  3. Linux系统 Centos7/Centos6.8 yum命令在线安装 MySQL5.6

    Linux系统 Centos7 yum命令在线安装 MySQL5.6 标签: centosmysqlyum 2015-11-18 17:21 707人阅读 评论(0) 收藏 举报  分类: Linux ...

  4. Centos 在线安装 nginx

    centos 在线安装 nginx 安装nginx ​ 参考文档: http://nginx.org/en/linux_packages.html 中的RHEL/CentOS章节,按照步骤安装repo ...

  5. CentOS在线安装RabbitMQ3.7

    一.通过yum命令在线安装RabbitMQ yum在线安装,简单.快捷.自动安装相关依赖包. 1.安装Erlang环境(RabbitMQ由Erlang语言开发) 1.1)下载rpm安装包 官方地址:h ...

  6. 在centos上安装mysql5.7的三种方法

    带OS信息的是已编译的二进制文件,不带OS信息的是源码包 mysql-5.7.14-linux-glibc2.5-x86_64.tar.gz 二进制包 mysql-5.5.51.tar.gz 源码包 ...

  7. centos 7安装mysql5.5

    首先centos7 已经不支持mysql,因为收费了你懂得,所以内部集成了mariadb,而安装mysql的话会和mariadb的文件冲突,所以需要先卸载掉mariadb,以下为卸载mariadb,安 ...

  8. CentOS在线安装JDK

    一.通过yum命令在线安装jdk 1.查看云端目前支持安装的jdk版本 [root@localhost ~]# yum search java|grep jdk ldapjdk-javadoc.noa ...

  9. centOS上安装MySQL5.7

    在centos上安装mysql,前提得有sudo的权限.没有的话先去跟管理员申请一个. STEP 1 - 安装MySQL 首先打开浏览器访问下 https://dev.mysql.com/downlo ...

随机推荐

  1. 模拟select选中option的效果

    大致情况如下:网页上有一个表单,表单中有一个select类型的控件,我要选择option后,表单相对应的input部分会option自动填充选中数据. 我想要的是:实现一个网页上的效果,在这个页面被打 ...

  2. 【Python】 日志管理logging

    logging *****本文参考了http://www.cnblogs.com/dkblog/archive/2011/08/26/2155018.html ■ 最最基本的用法 logging模块用 ...

  3. OSM数据下载地址

    1.OSM数据下载地址 官网下载: http://planet.openstreetmap.org/ GeoFabrik:http://www.geofabrik.de/ Metro Extracts ...

  4. Python中的classmethod与staticmethod

    首先,这是一个经典的问题. 我们首先做一个比较: classmethod的第一个参数是cls,即调用的时候要把类传入 这意味着我们我们可以在classmethod里使用类的属性,而不是类的实例的属性( ...

  5. 【Spring系列】spring mvc整合任务调度

    一.在dispatcher-servlet.xml中增加定时任务扫描路径和其余配置信息 xmlns:task="http://www.springframework.org/schema/t ...

  6. 『开源重编译』System.Data.SQLite.dll 自适应 x86 x64 AnyCPU 重编译

    背景: > System.Data.SQLite.dll 程序集 不能良好的支持 AngCPU 格式 System.Data.SQLite.dll 在 适应 x86 和 x64 有三个方案: & ...

  7. Beta Scrum Day 6

    听说

  8. 每日冲刺报告——Day4(Java-Team)

    第四天报告(11.5  周日) 团队:Java-Team 成员: 章辉宇(284) 吴政楠(286) 陈阳(PM:288) 韩华颂(142) 胡志权(143) github地址:https://git ...

  9. zookeeper提示Unable to read additional data from server sessionid 0x

    配置zookeeper集群,一开始配置了两台机器server.1和server.2. 配置参数,在zoo.cfg中指定了整个zookeeper集群的server编号.地址和端口: server.1=1 ...

  10. day-7 一个简单的决策树归纳算法(ID3)python编程实现

    本文介绍如何利用决策树/判定树(decision tree)中决策树归纳算法(ID3)解决机器学习中的回归问题.文中介绍基于有监督的学习方式,如何利用年龄.收入.身份.收入.信用等级等特征值来判定用户 ...