Connect to MySQL with JDBC over network

前端 未结 3 428
被撕碎了的回忆
被撕碎了的回忆 2020-12-11 10:36

I am trying to connect to MySQL database over a network. I have installed MySQL, and the service is running on the default port. I have also install the SQL connector to the

相关标签:
3条回答
  • 2020-12-11 11:22

    By default, MySQL doesnt allow remote access and only allow local access. You will have to modify your /etc/mysql/my.cnf config (on Linux) with:

    bind-address = 192.168.1.45 // Your Server IP address
    # skip-networking // This should be commented .
    

    See the whole procedure here.

    0 讨论(0)
  • 2020-12-11 11:23
    1. Check the my.cnf [mysqld] settings for the parameters port, bind-address, socket, to make sure these aren't causing problems.
    2. Check the files /etc/hosts, /etc/hosts.deny to make sure everything is ok.
    3. Check firewall applications
    4. Check to make sure whatever directory mysqld's sockets are have the appropriate permissions.
    5. Check to make sure that security settings within the mysql database (user table) permit access from your remote host.
    6. Make sure you can telnet OK to localhost 3306, 127.0.0.1 3306, and whatever other IP address your machine is configured to (use ifconfig to find out).
    0 讨论(0)
  • 2020-12-11 11:26

    You can test the server setup using the MySQL Workbench or mysql client which will narrow down the problem. It's also sometimes useful to just see if the server's there:

    telnet host 3306

    It'll tell you the version number of the server and some other binary junk. Enough to know your host is listening.

    0 讨论(0)
提交回复
热议问题