zoukankan      html  css  js  c++  java
  • 远程访问ubuntu下mysql的问题

    ubuntu下mysql不能用IP地址远程访问的问题解决

    方法1:

    1.mysql>grant all privileges on *.* to 'root'@'%' identified by 'root';
    

      

       (%) 表示所有ip

        第1个root表示账户

        第2个root表示密码

    2.mysql>flush privileges;

    3.停止并重启mysql服务。

    停止命令:

    service mysql stop

    启动命令:

    service mysql start

    查看状态:

    service mysql status

    如果以上操作还是不能访问,那么应该是mysql没有允许远程访问。

    修改配置文件:

    sudo vim /etc/mysql/mysql.conf.d/mysqld.cnf

    将bind-address = 127.0.0.1注释掉(即在行首加#),如下:

    代码如下:

    # Instead of skip-networking the default is now to listen only on
    # localhost which is more compatible and is not less secure.
    # bind-address          = 127.0.0.1

    然后重启服务即可访问了。

  • 相关阅读:
    CSS
    CSS
    HTML
    HTML
    HTML
    ubuntu server安装的一些坑
    Haproxy 开启日志记录
    nginx反向代理时保持长连接
    最简单的tomcat安装部署
    nginx的安装部署以及使用
  • 原文地址:https://www.cnblogs.com/fwl8888/p/9508892.html
Copyright © 2011-2022 走看看