关于MYSQL和PHP的安装

qyxc 2002-05-17 09:17:49
我用的是apache+php+mysql
具体是:
apache_1.3.24-win32-x86-no_src.exe
php-4.2.1-installer.exe
MYSQL4.0A
操作系统是win2000PRO
我已经能让apache浏览php3格式的网页了
我用
<? phpinfo(); ?>
生成的info.php3文件
在浏览器出现的结果

我主要是想问您一下:
我在mysql\bin\下用
mysqladmin -u root create mydb
不能创建数据库
出现提示:
mysqladmin: Unknown command: 'mydb'
只能用:
mysqladmin cteate mydb
来创建数据库。
创建数据库后,建立test.php3
<?php

$db = mysql_connect("localhost", "root");

mysql_select_db("mydb",$db);

$result = mysql_query("SELECT * FROM employees",$db);

printf("First Name: %s<>\n", mysql_result($result,0,"first"));

printf("Last Name: %s<>\n", mysql_result($result,0,"last"));

printf("Address: %s<>\n", mysql_result($result,0,"address"));

printf("Position: %s<>\n", mysql_result($result,0,"position"));

?>
在浏览器浏览出现以下结果:
Warning: Access denied for user: 'root@127.0.0.1' (Using password: NO) in d:\php\apache\htdocs\test.php3 on line 7

Warning: MySQL Connection Failed: Access denied for user: 'root@127.0.0.1' (Using password: NO) in d:\php\apache\htdocs\test.php3 on line 7

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in d:\php\apache\htdocs\test.php3 on line 9

Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in d:\php\apache\htdocs\test.php3 on line 11

Warning: mysql_result(): supplied argument is not a valid MySQL result resource in d:\php\apache\htdocs\test.php3 on line 13
First Name: <>
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in d:\php\apache\htdocs\test.php3 on line 15
Last Name: <>
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in d:\php\apache\htdocs\test.php3 on line 17
Address: <>
Warning: mysql_result(): supplied argument is not a valid MySQL result resource in d:\php\apache\htdocs\test.php3 on line 19
Position: <>
不知道是什么意思,您能告诉我怎么让这些东西顺利运行吗??
谢谢!!
...全文
9 点赞 收藏 3
写回复
3 条回复
切换为时间正序
当前发帖距今超过3年,不再开放新的回复
发表回复
qyxc 2002-05-18
我试试
回复
Drate 2002-05-17
$db = mysql_connect("localhost", "root");
你确认你的用户名,还有密码正确吗?错误提示中可是明确的指出了你的用户许可出了问题
回复
kingover 2002-05-17
$db = mysql_connect("localhost", "root","PASSWORD");
PASSWORD替换为你的mysql的root用户的密码。为空就空着
回复
相关推荐
发帖
基础编程
创建于2007-09-28

2.1w+

社区成员

从PHP安装配置,PHP入门,PHP基础到PHP应用
申请成为版主
帖子事件
创建了帖子
2002-05-17 09:17
社区公告
暂无公告