美文网首页
阿里云centos6安装mysql5.7

阿里云centos6安装mysql5.7

作者: hui2743 | 来源:发表于2017-10-10 21:45 被阅读0次

    1. 查看是否有已安装的mysql

    yum list installed | grep mysql
    

    2. 删除原有的mysql

    yum -y remove 第一步查出的程序名称
    

    3. 添加rpm源

    去mysql官网(https://dev.mysql.com/downloads/repo/yum/)找到最新的rpm下载链接:

    image.png

    下载并安装:

    wget dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
    yum localinstall mysql-community-release-el6-5.noarch.rpm
    

    4. 查看并只启用mysql57

    yum repolist all | grep mysql
    yum-config-manager --disable mysql55-community
    yum-config-manager --disable mysql56-community
    yum-config-manager --enable mysql57-community-dmr
    

    5. 安装mysql

    yum install mysql-community-server
    

    6. 启动mysql服务并设置成开机启动

    service mysqld start
    chkconfig --list | grep mysqld
    chkconfig mysqld on
    

    7. 查看自动生成的临时密码

    grep 'temporary password' /var/log/mysqld.log
    

    8. 使用输出的临时密码登陆mysql

    mysql -u root -p
    

    9. 关闭密码复杂性验证

    mysql> set global validate_password_policy=0;
    

    10. 设置密码

    mysql> set password = password('youpassword');
    

    11. 允许用户远程连接

    mysql> grant all privileges on  *.* to 'root'@'%' identified by 'youpassword' with grant option;
    mysql> flush privileges;
    mysql> exit;
    

    相关文章

      网友评论

          本文标题:阿里云centos6安装mysql5.7

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