美文网首页Centos7LNMP集合
Centos7 安装 Mysql最新版

Centos7 安装 Mysql最新版

作者: 57fc17b7d598 | 来源:发表于2015-11-30 12:33 被阅读811次

通过Yum安装


  1. 在官网找到对应的rpm
    <pre>http://dev.mysql.com/downloads/repo/yum/</pre>
  2. 点击download进入下载
    <pre>http://dev.mysql.com/downloads/file/?id=459921</pre>
  3. 在页面底部有个名为《 No thanks, just start my download.》的链接,这个链接就是下载地址。
    <pre>http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm</pre>
  4. 在服务器上安装rpm
    <pre>rpm -ivh http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm</pre>
  5. 更新yum
    <pre>yum update</pre>
  6. 安装mysql
    <pre>yum install -y mysql-community-server</pre>
  7. 开启mysql服务
    <pre>systemctl start mysqld.service</pre>
  8. 获取mysql默认密码
    <pre>grep 'temporary password' /var/log/mysqld.log</pre>

2015-11-30T03:16:23.337689Z 1 [Note] A temporary password is generated for root@localhost: ylW?D-q+l6Ip

命令运行后得到上面一句字符串,其中ylW?D-q+l6Ip就是密码

  1. mysql安全配置
    <pre>mysql_secure_installation</pre>
  • Enter password for user root:
    输入刚刚得到的密码
  • New password:
    输入新的密码
  • Re-enter new password:
    重复输入新的密码
  • Change the password for root ? ((Press y|Y for Yes, any other key for No)
    是否想改变root的密码,输入Y,重复设置密码。
  • Do you wish to continue with the password provided?(Press y|Y for Yes, any other key for No)
    输入Y
  • Remove anonymous users? (Press y|Y for Yes, any other key for No)
    删除匿名用户,输入Y
  • Disallow root login remotely? (Press y|Y for Yes, any other key for No)
    是否禁止远程登录,输入N,(但事后发现还是不能远程登录,可以试试Y)
  • Remove test database and access to it? (Press y|Y for Yes, any other key for No)
    是否删除test数据库,输入N
  • Reload privilege tables now? (Press y|Y for Yes, any other key for No)
    是否重新加载权限表,输入Y
  1. 安装完成
    可以通过mysql -uroot -p登录,密码是刚刚设置的

相关文章

网友评论

    本文标题:Centos7 安装 Mysql最新版

    本文链接:https://www.haomeiwen.com/subject/uwljhttx.html