美文网首页
Centos7.5安装mysql

Centos7.5安装mysql

作者: 一纸繁鸢w | 来源:发表于2019-11-14 14:42 被阅读0次

    1. 卸载原有mysql

    rpm -qa | grep mysql
    rpm -e --nodeps mysql*
    

    2. 下载mysql的repo源

    wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
    

    如果报错:-bash: wget: 未找到命令
    安装插件:yum -y install wget

    3. 安装mysql-community-release-el7-5.noarch.rpm

    sudo rpm -ivh mysql-community-release-el7-5.noarch.rpm
    

    4. 安装MySQL

    sudo yum install mysql-server
    

    5. 重置MySQL密码

    先授权/var/lib/mysql访问权限

    chown root /var/lib/mysql/
    mysql -u root
    use mysql;
    update user set password=password('你的密码') where user='root';
    exit;
    service mysqld restart  # 重启mysql服务
    

    6. 配置远程访问

    mysql -u root -p
    : 输入上面设置的密码
    GRANT ALL PRIVILEGES ON *.* TO root@"%" IDENTIFIED BY "远程访问密码";
    service mysqld restart  # 重启mysql服务
    

    7. 关闭防火墙

    systemctl stop firewalld.service
    

    相关文章

      网友评论

          本文标题:Centos7.5安装mysql

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