CentOS6.5安装MySQL5.7.9

本文详细记录了在CentOS6.5上安装MySQL5.7.9的过程,包括从添加yum库到设置密码的步骤。在设置密码时遇到了validate_password插件的密码策略问题,最终成功设置了符合要求的强密码。
摘要由CSDN通过智能技术生成

背景

这几天有时间连接到我的阿里云上看了下,以前好像也没在上面做什么东西,索性这几天决心要搞,就从头来过,然后详细的记录下来,以后还可以回头再来看看.

开始

直接就操作了”重新初始化磁盘”,一切都是新的了,删掉了以前的快照.然后登陆进去

>yum update

安装MySQL

看了下yum库里面只有MySql5.1,太老了,google了一下,找到了mysql的官网,跟着操作一下:

  • 下载含有yum库的rpm包,CentOS6.5,选择:Red Hat Enterprise Linux 6 / Oracle Linux 6 (Architecture Independent), RPM Package版本,我现在现在到的文件是:mysql57-community-release-el6-7.noarch.rpm

  • 添加yum库

    >rpm -Uvh mysql57-community-release-el6-7.noarch.rpm

  • 安装

    >yum install mysql-community-server

  • 启动

    >sudo service mysqld start

  • 查看状态

    >sudo service mysqld status

  • 设置密码

    >mysql_secure_installation

    这里和之前的版本有些不同,执行mysql_secure_installation后需要输入密码,整个安装过程都没有输入密码的地方,这里很茫然.后来搜索了一下,原来出事密码记录在安装日志里面了

  • 查看默认密码:

    >grep “password” /var/log/mysqld.log
    >[Note] A temporary password is generated for root@localhost: e-wmIr.ot0nU

  • 再次输入mysql_secure_installation就可以设置新密码了:

    >mysql_secure_installation
    >Enter password for user root:

  • 密码强度

    到这里我以为一切都很顺利,没想到,设置密码的过程让我差点崩溃.
    我列出我设置过的密码:

    • 10位以上纯数字
    • 10位以上纯字母
    • 10位以上数字+字母
    • 10位以上数字+大小写字母
    • 32位数字+大小写字母

    返回的提示全部都是

    >Your password does not satisfy the current policy requirements

    崩溃!!!

    没办法,再去google一下吧,找到这个,大概看了一下,自从MySQL5.6.6以后添加了一个validate_password的插件.

    大概介绍一下:这个插件会把密码分为三个等级,LOW(弱),MEDIUM(中),STRONG(强),数值从1-100.如果你的密码检测得到的结果是LOW,对不起,密码不能使用.我们再来看下三个级别的定义:

    LOW:密码必须至少8个字符。

    MEDIUM:在LOW的基础上,密码必须包含至少1个数字字符,1小写和大写字符和一个特殊(非字母数字)字符的条件。

    STRONG:在MEDIUM基础上,每截取4个或者更长的字符不能是字典文件里面的单词(如果指定了字典文件)

    知道了这些,终于可以设置一个有效的密码了吧.正好昨天刚安装可KeePassX,按照他规则生成一个密码,强度100:

    >Estimated strength of the password: 100

    后面就是简单的设置了:

Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No) : y
By default, a MySQL installation has an anonymous user,
allowing anyone to log into MySQL without having to have
a user account created for them. This is intended only for
testing, and to make the installation go a bit smoother.
You should remove them before moving into a production
environment.

Remove anonymous users? (Press y|Y for Yes, any other key for No) : y
Success.

Normally, root should only be allowed to connect from
'localhost'. This ensures that someone cannot guess at
the root password from the network.

Disallow root login remotely? (Press y|Y for Yes, any other key for No) : y
Success.

By default, MySQL comes with a database named 'test' that
anyone can access. This is also intended only for testing,
and should be removed before moving into a production
environment.

Remove test database and access to it? (Press y|Y for Yes, any other key for No) : n

 ... skipping.
Reloading the privilege tables will ensure that all changes
made so far will take effect immediately.

Reload privilege tables now? (Press y|Y for Yes, any other key for No) : y
Success.

All done! 
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值