CentOS6.5安装MySQL5.7.9

背景

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

开始

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

>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! 
发布了50 篇原创文章 · 获赞 29 · 访问量 28万+
展开阅读全文

centos6安装mysql5.7出错:yum install mysql-community-server出错

07-25

安装mysql5.7,参考教程:https://www.php.cn/mysql-tutorials-386847.html 一开始不知道 地址中的el7应该对应自己的centos版本,直接执行该命令进行下载 ``` wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm ``` 然后执行以下命令也没有报错, ``` yum -y localinstall mysql57-community-release-el7-11.noarch.rpm ``` 但是执行下面命令的时候一直报错 ``` yum -y install mysql-community-server ``` 之后重新下载centos6的版本,安装源 ``` # wget https://dev.mysql.com/get/mysql57-community-release-el6-11.noarch.rpm # yum -y localinstall mysql57-community-release-el6-11.noarch.rpm ``` 然而进行安装的时候还是报错 ``` yum -y install mysql-community-server ``` 原因在于他还是跑去安装el7的版本了 ``` ---> Package mysql-community-server.i686 0:5.7.17-1.el7 will be 安装 ``` 尝试了各种方法,重装了好多次,能删除的就删除,结果一直都是这样 获取mysql-community-server的信息,结果如下: ![图片说明](https://img-ask.csdn.net/upload/201907/25/1563987255_628071.png) 尝试删除无果: ``` [root@localhost ~]# yum remove mysql-community-server 已加载插件:fastestmirror, security 设置移除进程 参数 mysql-community-server 没有匹配 Loading mirror speeds from cached hostfile Package(s) mysql-community-server available, but not installed. 不删除任何软件包 ``` 真的搞了一天,心累啊!如果哪个好心人看到,可以提点提点,真的万分感谢! 问答

没有更多推荐了,返回首页

©️2019 CSDN 皮肤主题: 大白 设计师: CSDN官方博客

分享到微信朋友圈

×

扫一扫,手机浏览