zoukankan      html  css  js  c++  java
  • mysql 远程连接 10061和ERROR 1130解决办法

    一、

    Can't connect to Mysql on '192.168.0.106'(10061)
    无法连接到192.168.0.106(10061)上的Mysql
    

    提示10061,是指无法连接到3306端口

    root@638412a7bd0d:/# netstat -anp
    输出:
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 127.0.0.1:3306            :::*               LISTEN      -
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      10/apache2
    tcp        0      0 172.17.0.3:3306         192.168.0.105:50183     ESTABLISHED -
    Active UNIX domain sockets (servers and established)
    Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
    unix  2      [ ACC ]     STREAM     LISTENING     1821025  1/python            /var/run/supervisor.sock.1
    unix  2      [ ACC ]     STREAM     LISTENING     1821177  -                 /var/run/mysqld/mysqld.sock
    
    root@638412a7bd0d:/# vi /etc/mysql/my.cnf
    找到:
    bind-address = 127.0.0.1(默认只监听本地)并注释这一行
    
    root@638412a7bd0d:/# netstat -anp
    Active Internet connections (servers and established)
    Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
    tcp        0      0 :::3306            :::*               LISTEN      -
    tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      10/apache2
    tcp        0      0 172.17.0.3:3306         192.168.0.105:50183     ESTABLISHED -
    Active UNIX domain sockets (servers and established)
    Proto RefCnt Flags       Type       State         I-Node   PID/Program name    Path
    unix  2      [ ACC ]     STREAM     LISTENING     1821025  1/python            /var/run/supervisor.sock.1
    unix  2      [ ACC ]     STREAM     LISTENING     1821177  -                   /var/run/mysqld/mysqld.sock
    
    service mysql restart
    

    二、

    ERROR 1130: Host '192.168.0.106' is not allowed to connect to this MySQL server
    错误1130:不允许主机“192.168.0.106”连接到该MySQL服务器
    

    not allowed to connect:远程的主机没有权限来连接

    进入mysql
    mysql -u root	-p
    
    grant all privileges on *.* to 'root'@'%' identified by 'mysql密码';
    
    flush privileges; (让权限立即生效)
    
    

    一般安装完数据库的需要远程连接,正常配置是设置端口,然后设置权限。

  • 相关阅读:
    cache 元素 数据类型类(1)
    cache 存储数据访问
    cache类的元素
    COS(cache objectscript)语言及语法cache对象及对象类型
    cache创建数据库
    cache 元素 数据类型类(2)
    usaco1.3.3 Calf Flac 我的题解
    USACO the castle
    Ordered Fractions usaco
    【转】IBM Rational Rose 操作指南(下)
  • 原文地址:https://www.cnblogs.com/rab3it/p/12403522.html
Copyright © 2011-2022 走看看