简体   繁体   English

MySQL访问被拒绝错误,但一切正确!

[英]MySQL access denied error but everything is correct!

Here's my code 这是我的代码

<?php
$host = 'localhost';
$username = 'sam_sam';
$password = '[censored]';
$name = 'sam_ballpointradio';
mysql_connect($host, $db_username, $db_password)
or die(mysql_error());
mysql_select_db($db_name) or die(mysql_error());
?>

and the error message is 错误消息是

Warning: mysql_connect() [function.mysql-connect]: Access denied for user 'sam'@'localhost' (using password: NO) in /home/sam/public_html/ballpointradio/db_config.php on line 6 警告:mysql_connect()[function.mysql-connect]:在第6行的/home/sam/public_html/ballpointradio/db_config.php中,对用户'sam'@'localhost'的访问被拒绝(使用密码:NO)
Access denied for user 'sam'@'localhost' (using password: NO) 用户'sam'@'localhost'的访问被拒绝(使用密码:否)

I know all the information is correct, but it's a weird error because it says I'm NOT using a password, but I am... 我知道所有信息都是正确的,但这是一个奇怪的错误,因为它说我没有使用密码,但是我...

变量命名问题?

mysql_connect($host, $username, $password)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM