cant connect mysql db from remote machine even after creating a user

Viewed 48

i have written a java code to connect my mysql db. its absolutely working fine. but now i want to run this code from different machine. to access this db. i have tried many posts, then i found some information about creating user to give access.

so firstly, i added a user with all access from mysql workbench. then i checked my ip address, 192.168.*.***;

then, made some changes to my code so that i can be access by my ip the code is,

String url = "jdbc:mysql://192.168.*.***:3306/db?autoReconnect=true&useSSL=false";
           Class.forName ("com.mysql.jdbc.Driver");
           conn = DriverManager.getConnection (url,"user","pass");
           System.out.println ("Database connection established");

and when i tries this code from remote machines. it gives error:

com.mysql.jdbc.exceptions.jdbc4.MySQLNonTransientConnectionException: Could not create connection to database server. Attempted reconnect 3 times. Giving up.

when i tried to ping the remote machine from server machines it was successfulll... but when i tried to ping server machine from remote machines, it was not...!!!

so, any one please help me?

i have also created a user from cmd, using CREATE USER 'user'@'%' IDENTIFIED BY 'pass';

  • also my firewall is also off. the mysql in services is also running. then whats wrong with my code? please help.

some where i read about bind address, but in my windows: C:\Program Files\MySQL\MySQL Server 5.7 there is no my.ini file to make changes.

then, what is missing ??????

1 Answers
Related