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. PHP 5.x和PHP 7 Closure不同行为问题

    同样一段闭包代码,PHP 7 ok的,PHP 5.5.11(Windows 开发机器)上却报错,以为是PHP 5 bug,原来是用法不对,记录一下~ 原代码(自己写的框架的路由部分)最初是这样写的: ...

  2. 创建Jdbc封装工具类

    jdbc.propertie url=jdbc:mysql:///empye user=root password=root driver=com.mysql.jdbc.Driver 读取资源文件  ...

  3. tensorflow-线性函数训练例子一

    import tensorflow as tfimport numpy as np #create datax_data = np.random.rand(100).astype(np.float32 ...

  4. FluentDataflow - Fluent Style TPL Dataflow

    我的新英文博客文章: FluentDataflow - Fluent Style TPL Dataflow 介绍了本人最新发布的一个开源类库:FluentDataflow--Fluent风格的TPL ...

  5. Foxmail6.5 ERR LOGIN FAIL 重新输入口令

    这几天 Foxmail 6.5 收邮件不正常,一直报告ERR LOGIN FAIL,要求重新输入口令. 但输入正确的口令也无法收邮件. 反复折腾,最后发现如下设置即可: 邮箱账户设置 --> 邮 ...

  6. [SQL]LeetCode180. 连续出现的数字 | Consecutive Numbers

    SQL架构: Create table If Not Exists Logs (Id int, Num int) Truncate table Logs insert into Logs (Id, N ...

  7. [Swift]LeetCode380. 常数时间插入、删除和获取随机元素 | Insert Delete GetRandom O(1)

    Design a data structure that supports all following operations in averageO(1) time. insert(val): Ins ...

  8. [Swift]LeetCode785. 判断二分图 | Is Graph Bipartite?

    Given an undirected graph, return true if and only if it is bipartite. Recall that a graph is bipart ...

  9. [Swift]LeetCode990. 等式方程的可满足性 | Satisfiability of Equality Equations

    Given an array equations of strings that represent relationships between variables, each string equa ...

  10. javascript之reduce()方法的使用

    以前看到reduce方法,总是看得我头皮发麻,今天无意间又遇到他了,于是学习了下,接触之后,觉得这个方法还挺好用的,在很多地方都可以派上用场,比如,数组中元素求和.数组去重.求数组中的最大值或最小值等 ...