用户'test123'@'192.168.0.38'的访问被拒绝(使用密码:否) [英] Access denied for user 'test123'@'192.168.0.38' (using password: NO)
本文介绍了用户'test123'@'192.168.0.38'的访问被拒绝(使用密码:否)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在byethost31.com(免费托管站点)上运行此代码,因此我面临控制台'.用户对'test123'@'192.168.0.38'的访问被拒绝(使用密码:否)的错误.>
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>";
}
?>
推荐答案
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.
我建议您先查看PDO
或mysqli
,而不要使用弃用的 mysql_*
api.
I would recommend that you take a look at PDO
or mysqli
instead of using the deprecated mysql_*
api.
这篇关于用户'test123'@'192.168.0.38'的访问被拒绝(使用密码:否)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文