Access denied for user 'test123'@'192.168.0.38' (using password: NO)

梦想与她 提交于 2019-12-13 09:30:34

问题


I want to run this code on byethost31.com (free hosting site) so i am facing " Access denied for user 'test123'@'192.168.0.38' (using password: NO)" Error on console..

<?php
$localhost="*************";
$pass="*************";
$usename="*************";
$dbname="*************";

$s=mysql_connect($localhost,$pass,$username);
$t=mysql_select_db($dbname);


if($s ){
 echo "Mysql_connect is successful. <hr>";
}

if($t ){
 echo "Mysql_select_db is successful.. <hr>"; 
}

?>

回答1:


If you check the documentation for the mysql_connect function, you will see that the params it takes is: Server, Username, Password in that order. You send your password in as username instead of the other way.

I would recommend that you take a look at PDO or mysqli instead of using the deprecated mysql_* api.



来源:https://stackoverflow.com/questions/32269976/access-denied-for-user-test123192-168-0-38-using-password-no

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!