美文网首页
MySQL安装 based on CentOS7.2

MySQL安装 based on CentOS7.2

作者: 一课一练 | 来源:发表于2017-10-10 16:53 被阅读0次
    1. 卸载MariaDB
      自CentOS7起,MariaDB替代了MySQL作为其默认支持数据库,为避免冲突,先卸载MariaDB
    rpm -qa | grep mariadb
    rpm -e mariadb-libs-5.5.37-1.el7_0.x86_64
    // or 强制卸载MariaDB 
    rpm -e --nodeps mariadb-libs-5.5.37-1.el7_0.x86_64
    // 安装依赖
    yum install libaio net-tools
    
    1. 安装MySQL
    // 获取repo
    wget http://repo.mysql.com/mysql-community-release-el7-5.noarch.rpm
    // 安装repo
    rpm -ivh mysql-community-release-el7-5.noarch.rpm
    // 安装mysql
    yum install mysql-server
    // 重启服务
    service mysqld restart
    // 防火墙开端口
    firewall-cmd --zone=public --add-port=3306/tcp --permanent
    firewall-cmd --reload
    
    1. 设置root
    mysql -u root
    mysql > use mysql;
    mysql > update user set password=password('123456') where user='root';
    mysql > GRANT ALL PRIVILEGES ON *.* TO 'root'@'%'WITH GRANT OPTION;     //任何远程主机都可以访问数据库 
    mysql > exit;
    

    相关文章

      网友评论

          本文标题:MySQL安装 based on CentOS7.2

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