安卓连接mysql报错Caused by: java.net.ConnectException: failed to connect to localhost/127.0.0.1 (port 3306

版权声明:转载请联系博主、标明出处 https://blog.csdn.net/jyfbug/article/details/89211749

这次的报错是因为我在安卓虚拟机上连接数据库使用的是localhost,但是这样会使安卓虚拟机认为是本机(127.0.0.1),因此在连接本地数据库时将ip改为10.0.2.2或局域网内本机的ip,即可在安卓虚拟机上连接电脑的本地数据库。

猜你喜欢

转载自blog.csdn.net/jyfbug/article/details/89211749