0

I have an java app that connects to a database. I have some computers connected in the same router and one of them is supposed to be the server. So in its localhost I created the database with the tables. Let's say that the db is in A, with IP 192.168.0.a and the app is in computer B with IP 192.168.0.b! To access the db from B I must do something like this jdbc:mysql://192.168.0.a:3306/dbName, but if I do not add a user in database with host 192.168.0.b, the app will not work. So the question is: Is there a way to tell the database to accept request from all computers without adding users manually? Thanks in advance!

Dionis Beqiraj
  • 677
  • 7
  • 28

1 Answers1

1

MySQL uses % as a wildcard, so for "any host", it's enough to create an user with % as host:

CREATE USER 'user'@'%' IDENTIFIED BY 'somepassword';

Also, after this you'll need to grant the user 'user'@'%' rights to any databases it might need.

esaj
  • 15,637
  • 4
  • 36
  • 52