1.更新 yum mysql5.7 源

  1. #wget http://repo.mysql.com/mysql57-community-release-el6-8.noarch.rpm
  2. #rpm -ivh mysql57-community-release-el6-8.noarch.rpm

2.yum mysql 源配置

  1. 禁用MySQL5.6的源:#yum-config-manager --disable mysql56-community
  2. 启用MySQL5.7的源:#yum-config-manager --enable mysql57-community-dmr

3.查看 mysql install list

  1. #yum repolist enabled | grep mysql

4.安装 mysql

  1. #yum install mysql-community-server

这里会报错:

,缺少libsasl2.so.2()(64bit)

解决办法:

  • 修改 yum mysql 源:#vim /etc/yum.repos.d/mysql-community.repo

[mysql57-community]
        name=MySQL 5.7 Community Server
        ## baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/6/$basearch/
        baseurl=http://repo.mysql.com/yum/mysql-5.7-community/el/7/$basearch/
        enabled=1
        gpgcheck=0
        gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-mysql

  • 再次安装 mysql: #yum install mysql-community-server

5.配置 mysql 字符集

  • #vim /etc/my.cnf,在文件末尾加上:character-set-server=utf8

6.启动 mysql 服务

  • #service mysqld start
  • 停止 mysql 服务:#service mysqld stop

7.查询首次安装随机密码

  • #grep 'password' /var/log/mysqld.log |head -n 1

8.登陆数据库

  • #mysql –u root –p,输入上面查询的密码登陆

9.修改 root 密码

  • 首次登陆进去会出现提示:

You must reset your password using ALTER USER statement before executing this statement.

(在执行此语句之前,必须使用ALTE USER语句重设密码。)

  • 个人学习使用,所以密码设为:root,

alter user user() identified by "root";

但是会报 Your password does not satisfy the current policy requirements.(您的密码不符合当前的策略要求。)

  • 首先,修改 mysql5.7 的默认密码策略:

1. set global validate_password_policy=0;(密码长度符合即可)

2. set global validate_password_length=1;(修改密码默认长度为最小值,即4位)

  • 再次设置密码:alter user user() identified by "root";

  • exit; 退出,使用新密码登陆 mysql

10.远程访问

  • 防火墙设置 mysql 端口白名单:#vim /etc/sysconfig/iptables

-A INPUT -p tcp -m state --state NEW -m tcp --dport 3306 -j ACCEPT

重启防火墙,#service iptables restart

  • 登陆 mysql 创建远程访问用户’root',密码为’root’:create user 'root'@'%' identified by 'root';

查询 mysql 库的 user 表:select host, user from user;

  • 授权:grant all privileges on *.* to 'root'@'%';

  • 测试

CentOS7.3 yum install MySQL5.7的更多相关文章

  1. 阿里云Centos7使用yum安装MySQL5.6的正确姿势

    阿里云Centos7使用yum安装MySQL5.6 阿里云Centos7使用yum安装MySQL5.6 前言:由于某些不可抗力,我要在自己的阿里云服务器上搭建hadoop+hive+mysql+tom ...

  2. CentOS7 通过YUM安装MySQL5.7 linux

    CentOS7 通过YUM安装MySQL5.7 1.进入到要存放安装包的位置 cd /home/lnmp 2.查看系统中是否已安装 MySQL 服务,以下提供两种方式: rpm -qa | grep  ...

  3. Centos7使用yum安装Mysql5.7.19的详细步骤(可用)

    Centos7的yum源中默认是没有mysql,因为现在已经用mariaDB代替mysql了. 首先我们下载mysql的repo源,我们可以去mysql官网找最新的repo源地址 地址: https: ...

  4. CentOS7使用yum安装mysql5.7

    提前说一下,网速不好不要用yum安装,等得时间太长. 第一步.获取yum源 [root@youxi1 ~]# rpm -ivh https://repo.mysql.com/yum/mysql-5.7 ...

  5. CentOS7 通过YUM安装MySQL5.7

    1.进入到要存放安装包的位置 cd /home/lnmp 2.查看系统中是否已安装 MySQL 服务,以下提供两种方式: rpm -qa | grep mysql yum list installed ...

  6. centos7.6 yum安装mysql5.7版本

    由于mysql5.5及之前的版本一些项目上线报错 卸载: 首先删除centos上原来的mysql老版本,注意备份,清理干净. 之前怎么安装的清理,防止卸载不干净会有冲突. 我之前yum安装mysql5 ...

  7. CentOS7.6 yum install Git

    1. yum install git 2. git version or git –version 3. uninstall:  git remove

  8. CentOS7通过YUM安装MySQL5.6

    检查系统中的 MySQL,并删除现有的 Mysql 软件包. $ rpm -qa | grep mysql 这里如果没有返回任何东西证明没有安装任何 MySQL 相关的应用.如下图: 由于 cento ...

  9. Centos7使用yum安装MySQL5.6的正确姿势

    centos自带的repo是不会自动更新每个软件的最新版本,所以无法通过yum方式安装MySQL的高级版本. 所以,即使使劲用yum -y install mysql mysql-server mys ...

随机推荐

  1. iOS浏览器 new Date() 返回 NaN

    问题 项目中某个地方用到了倒计时,因此打算通过 new Date() 函数实现.但在 iPhone 真机测试的时候,显示的结果不符合预期.通过调试发现 iOS 中 new Date('2017-01- ...

  2. Java 短信发送

    package com.test; import org.apache.commons.httpclient.Header;import org.apache.commons.httpclient.H ...

  3. Unbuntu 16.04 英文环境安装中文输入法

    ubuntu 16.04 使用的是ibus输入系统,没有预装中文输入法,你要自己安装一下.以中文拼音输入法为例:1.sudo apt install ibus-pinyin2.sudo apt ins ...

  4. linux系统中的时间

    1.编程显示系统时间: #include <stdio.h> #include <time.h> /* gcc -o fix fixedFormatTime.c ./fix * ...

  5. nginx+letsencrypt搭建https站点

    1. 申请好自己的域名 dockerhub.xxx.com,并解析好IP. 2. 安装nginx(默认开通了http) ,修改 server_name dockerhub.xxxx.com; 启动. ...

  6. 操作系统中 heap 和 stack 的区别

    操作系统中 heap 和 stack 的区别heap 和 stack是什么堆栈是两种数据结构.堆栈都是一种数据项按序排列的数据结构,只能在一端(称为栈顶(top))对数据项进行插入和删除.==在单片机 ...

  7. [Swift]LeetCode722. 删除注释 | Remove Comments

    Given a C++ program, remove comments from it. The program source is an array where source[i] is the  ...

  8. VSphere虚拟化ESXi的安装及基本管理

    虚拟化和云计算技术正在快速的发展,新的概念.观点.产品不断涌现.服务器虚拟化技术受到了人们的高度重视,普遍相信虚拟化将成为数据中心的重要组成部分.vSphere是VMware公司推出的一套服务器虚拟化 ...

  9. webpack的基本配置项

    const path = require("path"); const HtmlWebpackPlugin = require("html-webpack-plugin& ...

  10. 『离散化 discrete』

    离散化(discrete) 离散化可以说是一个很基础的算法吧,但是有些时候还是很好用很有必要的算法. 离散化的排序的一个运用,具体地讲,离散化算法是将无穷大集合中的若干个元素映射到有限大小的集合中,以 ...