PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, January 15, 2022

[FIXED] Connecting to MySQL from Java to WAMP / MAMP Pro

 January 15, 2022     java, jdbc, mamp, mysql, wamp     No comments   

Issue

I am trying to connect from java to a MySQL database from an external computer on a machine hosting WAMP and other hosting MAMP Pro. The connection to WAMP is fine but on MAMP Pro, I get the following error.

              String userName = "user";
              String password = "pass";
              String url1="jdbc:mysql://<IP Address>:3306/dbname";
              Class.forName ("com.mysql.jdbc.Driver").newInstance ();
              conn1=DriverManager.getConnection (url1, userName, password);


The last packet sent successfully to the server was 0 milliseconds ago. 
The driver has not received any packets from the server.

I had changed the privellages in both the server by going to Privellages in PhpMyAdmin and chaning host to any host under Login Information. Worked for WAMP but didn't work for MAMP Pro.

Any suggestions?


Solution

I'm answering my own question but after some struggle I found the solution. Hopefully it will help people like me in future.

I opened MAMP Pro and on Server - General tab I clicked

File => Edit Template => MySql my.conf and changed 
line no 37 from 
bind-address=127.0.0.1 to bind-address = <my server's IP Address>


Answered By - Ank
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing