zoukankan      html  css  js  c++  java
  • Centos7 下安装mysql数据库

    centos7系统,安装mysql发现已经默认的是mariadb。

    只能安装mariadb,mariadb是mysql一个分支,对mysql完全支持

    1 安装

    yum -y install mariadb* 
    [root@localhost ~]# systemctl start mariadb.service  
    [root@localhost ~]# systemctl enable mariadb.service 
    ln -s '/usr/lib/systemd/system/mariadb.service' '/etc/systemd/system/multi-user.target.wants/mariadb.service'  

    2 修改远程访问权限

    mysql -h localhost -u root;  //这样应该可以进入MySQL服务器
    GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' WITH GRANT OPTION ;     //赋予任何主机访问数据的权限
    
    FLUSH PRIVILEGES ;//修改生效
    exit //退出

    3 远程访问 1003 错误

    CentOS 7.0默认使用的是firewall作为防火墙。

    1)、直接关闭防火墙

    systemctl stop firewalld.service #停止firewall

    systemctl disable firewalld.service #禁止firewall开机启动

    2)、设置 iptables service

    yum -y install iptables-services

    如果要修改防火墙配置,如增加防火墙端口3306

    vi /etc/sysconfig/iptables 

    增加规则

    -A INPUT -m state --state NEW -m tcp -p tcp --dport 3306 -j ACCEPT

    保存退出后

    systemctl restart iptables.service #重启防火墙使配置生效

    systemctl enable iptables.service #设置防火墙开机启动

    最后重启系统使设置生效即可。

    只测试第一种方法,关闭防火墙,第二种没用

  • 相关阅读:
    python 默认编码( UnicodeDecodeError: 'ascii' codec can't decode)
    python发送各类邮件的主要方法
    python输出htmltestrunner中文乱码如何解决
    Python unittest 官方文档
    Python pip 安装包
    Python easy_insatll 安装包
    linux 解压操作命令
    vim 操作指令2
    vim 操作指令1
    (转)水波纹过渡特效
  • 原文地址:https://www.cnblogs.com/a9999/p/5646825.html
Copyright © 2011-2022 走看看