从 Java 连接到 MySQL 到 WAMP / MAMP Pro
我正在尝试从托管 WAMP 和其他托管 MAMP Pro 的计算机上的外部计算机从 java 连接到 MySQL 数据库。与 WAMP 的连接正常,但在 MAMP Pro 上,出现以下错误。
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.
我通过转到 PhpMyAdmin 中的权限并将主机更改为登录信息下的任何主机来更改两台服务器中的权限。适用于 WAMP,但不适用于 MAMP Pro。
有什么建议吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我正在回答我自己的问题,但经过一番努力我找到了解决方案。希望它将来能帮助像我这样的人。
我打开 MAMP Pro 并在服务器 - 常规选项卡上单击
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