CentOS6.5安装MySQL5.7.9

来源:互联网 发布:java定义二维数组 编辑:程序博客网 时间:2024/05/29 12:47

背景

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

开始

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

>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) : yBy default, a MySQL installation has an anonymous user,allowing anyone to log into MySQL without having to havea user account created for them. This is intended only fortesting, and to make the installation go a bit smoother.You should remove them before moving into a productionenvironment.Remove anonymous users? (Press y|Y for Yes, any other key for No) : ySuccess.Normally, root should only be allowed to connect from'localhost'. This ensures that someone cannot guess atthe root password from the network.Disallow root login remotely? (Press y|Y for Yes, any other key for No) : ySuccess.By default, MySQL comes with a database named 'test' thatanyone can access. This is also intended only for testing,and should be removed before moving into a productionenvironment.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 changesmade so far will take effect immediately.Reload privilege tables now? (Press y|Y for Yes, any other key for No) : ySuccess.All done! 
0 0
原创粉丝点击