Remote Mysql access

前端 未结 6 1521
伪装坚强ぢ
伪装坚强ぢ 2020-12-18 15:50

I have problem to connect remote LAN MYSQL. While try following commands it shows the following error.

$ mysql -u root -h 192.168.1.15 -p
mysql>

6条回答
  •  陌清茗
    陌清茗 (楼主)
    2020-12-18 16:38

    You should also check that your MySQL server has been configured to accept remote TCP connections.

    In your MySQL configuration file (my.cnf), you need the following at least:

    port         = 3306          # Port MySQL listens on
    bind-address = 192.168.1.15  # IP address of your server
    # skip-networking            # This should be commented out to enable networking
    

    The default in some configurations is for the bind-address to be 127.0.0.1, or to skip networking completely, which means only local or unix socket connections are possible. This is for security reasons.

    You can also configure the bind-address to be 0.0.0.0 which means it will bind on all IP addresses on the server.

    And lastly, check your firewall configuration to allow port 3306.

提交回复
热议问题