美文网首页
centos下安装mysql

centos下安装mysql

作者: Eternally_夜雨 | 来源:发表于2017-07-19 17:43 被阅读0次

    下载mysql
    wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm

    image.png

    rpm -Uvh mysql57-community-release-el7-11.noarch.rpm 解压

    yum install mysql-community-server 安装服务

    systemctl start mysqld.service 启动服务

    grep 'temporary password' /var/log/mysqld.log 查看临时密码

    mysql -uroot -p
    mysql5.7默认安装了密码安全检查插件(validate_password),默认密码检查策略要求密码必须包含:大小写字母、数字和特殊符号,并且长度不能少于8位。否则会提示ERROR 1819 (HY000): Your password does not satisfy the current policy requirements错误,如下图所示

    image.png

    set global validate_password_policy=0; 修改密码安全等级

    image.png

    set global validate_password_length=6; 修改密码长度


    image.png

    允许远程连接
    mysql>use mysql;

    image.png

    mysql>update user set host = '%' where user= 'root';

    mysql> grant all privileges on . to 'root'@'%' with grant option;

    mysql>flush privileges;

    本地连接出现2003错误

    image.png

    解决办法关闭防火墙
    systemctl stop firewalld.service
    systemctl disable firewalld.service #禁止firewall开机启动
    再次本地连接
    如果你centos版本低可以安装低版本mysql
    yum install -y mysql-server mysql mysql-devel


    image.png

    service mysqld start
    最后设置root账号密码为root:mysqladmin -u root password 'root'
    进入mysql
    允许远程连接
    mysql> GRANT ALL PRIVILEGES ON . TO root@"%" IDENTIFIED BY "root";
    mysql> flush privileges;

    相关文章

      网友评论

          本文标题:centos下安装mysql

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