- 论坛徽章:
- 0
|
我安装了Solari伴侣自带的Apache1.3和Mysql3.2.43. 用gcc3.2编译了php4.2. 创建yj帐号, grant all priveliges. 用./mysql -u yj 都可工作. 为何在php login 时报错:
Warning: mysql_connect() [function.mysql-connect]: Access denied for user: 'yj@localhost' (Using password: YES) in /var/apache/htdocs/mysql.php on line 6
1046373023->;CTP0!
1046373023->;CTP1!
1046373023->;CTP2!
1046373023->;CTP3!
1046373023->;CTP4!
1046373023->;CTP5!
1046373023->;CTP6!
1046373023->;CTP7!
1046373023->;CTP8!
1046373023->;CTP9!
既然不可login, 为何还可以插入和显示数据?
PHP代码如下:
<?
define("DBName", "test"
define("HostName", "localhost"
define("UserName","yj"
define("assword",""
mysql_connect(HostName,UserName,Pasword);
/*
{
echo "Cannot get connected to the database " .DBName. "!<br>;";
echo mysql_error();
exit;
}
*/
mysql_select_db(DBName);
//@mysql_query("create table t(id int, a text)"
for ($i=0; $i<10; $i++)
{
$id=time();
mysql_query("insert into t(id, a) values ($id, 'CTP$i!')"
}
$r=mysql_query("select * from t"
for ($i=0; $i<mysql_num_rows($r); $i++)
{
$f=mysql_fetch_array($r);
echo "$f[id]->;$f[a] <br>; \n";
}
?>; |
|