4

Android应用程序访问远程数据库(mysql) is not allowed to connect to this MySQL ser...

 3 years ago
source link: https://blog.csdn.net/ljphhj/article/details/20766555
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Android应用程序访问远程数据库(mysql) is not allowed to connect to this MySQL server

胖虎 2014-03-08 10:07:59 1737

今天帮老师调试一个代码的时候,遇到android连接远程mysql数据库的问题,记下来方便之后查阅!

Logcat异常信息:

远程mysql_java.sql.SQLException: null, message from server: "Host '192.168.1.115' is not allowed to connect to this MySQL server

这句话的意思是mysql数据库不允许远程来访问它!

那么进入到你的mysql存放处:自己的电脑,或者租用的服务器
>>mysql -u root -p;
>>输入root密码
>>use mysql;
>>update user set host ='%' where user ='root';
这样就全部搞定了!!!

 在检查mysql服务开启后,3306端口也已经开放后连接数据库报"is not allowed to connect to this MySQL server"错误这种情况是因为MySQL安装完毕后不允许远程登录解决方法如下:1.执行 mysql -u root -p,然后输入密码登陆mysql2.授权法。使用myuser使用mypassword从任何主机连接到mysql服务器。执行:GRANT...


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK