AFP_555
AFP_555

Reputation: 2598

How to connect with remote MySQL database?

so I tried to connect to my local host with the 3306 port, and it works fine. Now, I'm using my second computer to connect to the database remotely.

  1. I use the jdbc:mysql://192.168.15.25:3306/yourdatabase type.
  2. My two computers are actually using the same IP.
  3. The trace says communication failure. I followed the problem, and it happens when I try to get the connection from the DriverManager.
  4. I did not touch the firewall at all.
  5. I did not write any permissions to users, as there are no users, just the admin.

Upvotes: 0

Views: 416

Answers (2)

Alexander Volkov
Alexander Volkov

Reputation: 8372

Two computers can't have same IP. Check the second for IP address using ifconfig command (if you have *nix system).

Upvotes: 2

Hackerman
Hackerman

Reputation: 12305

Follow this instructions:

Client PC:(sample ip: 192.168.0.105 want yo connect to mysql server on 192.168.0.172)
- Java app: user: dbuser, pass: dbpass, host: 192.168.0.172

Mysql Server PC:
- On mysql console: GRANT ALL PRIVILEGES ON *.* TO [email protected] identified by "dbpass";
  FLUSH PRIVILEGES;

Now you have all set to make a remote conection from your client to your mysql server.

Upvotes: 0

Related Questions