Host''不允许连接到此MySQL服务器

时间:2022-09-01 21:47:58

I am working on client/server side in android. And create a php file which contains only these lines of code:

我在android中的客户端/服务器端工作。并创建一个只包含以下代码行的php文件:

mysql_connect("192.184.10.45");  //line#3
mysql_select_db("Test_Data");
$sql=mysql_query("select * from registeration ");
mysql_close();

When I run this on browser then this give me these messages:

当我在浏览器上运行它时,这给了我这些消息:

Warning: mysql_connect() [function.mysql-connect]: Host ' ' is not allowed to connect to this MySQL server in C:\xampp\htdocs\Project1\server.php on line 3

警告:mysql_connect()[function.mysql-connect]:主机''不允许连接到第3行的C:\ xampp \ htdocs \ Project1 \ server.php中的MySQL服务器

1 个解决方案

#1


2  

pass username and password also here

在这里也传递用户名和密码

mysql_connect("192.184.10.45","username","password"); //line#3

And stop using mysql_* functions they are deprecating, use instead Mysqli OR PDO.

并停止使用他们弃用的mysql_ *函数,而不是使用Mysqli或PDO。

#1


2  

pass username and password also here

在这里也传递用户名和密码

mysql_connect("192.184.10.45","username","password"); //line#3

And stop using mysql_* functions they are deprecating, use instead Mysqli OR PDO.

并停止使用他们弃用的mysql_ *函数,而不是使用Mysqli或PDO。