云飞凡你好,mysql还用配数据源吗?
我在mysql里没有建立新的用户,使用的还是默认的root,只是改了密码jpwd。
这是怎么回事啊?$conn=mysql_connect("localhost","root","pwd");这样难道不对吗?
我在mysql里没有建立新的用户,使用的还是默认的root,只是改了密码jpwd。
这是怎么回事啊?$conn=mysql_connect("localhost","root","pwd");这样难道不对吗?
解决方案 »
- 这些码大概是什么字符串?
- 一个很简单的PHP问题,测试你的PHP水平
- 忙了几天,没头绪,高手进来看看,急!!!!!!!!
- 请教一下,如何设计标签体系[整站]
- 如何实现在一个文本框输入IP,子网掩码的文本框掩码自动出来,就像windows网络配置那样
- 各位高难度问题,高手进行
- 关于iconv函数和简繁转换一问
- Warning: Cannot use a scalar value as an array in D:\httpd\HTDOCS\xiaohong\cart.php on line 32
- 在php页面,如果对生成的临时表执行select
- PHP如何开启DBF数据库中的MEMO类型资料 急!!!!!!!!!!!!
- 我想把mssql里的数据转到MYSQL里,汉字编码如何处理啊?
- php如何连接另一台机器中的access数据库?
先执行
$link = mysql_connect('localhost', 'mysql_user', 'mysql_password');另外,这是最基础的问题,还是认真看下PHP手册中 函数参考->MySQL函数库 中各个函数的详细说明及使用方法吧.
<? $conn=mysql_connect("localhost","root","821007");
mysql_select_db("test");
$sql="select * from pet";
$result=mysql_query($sql);
?><form name="form1" method="post" action="">
<table width="200" border="1">
<tr>
<td>Name</td>
<td>Owner</td>
<td>Species</td>
</tr>
<?
while($arr=mysql_fetch_array($result))
{
?>
<tr>
<td><?echo "$arr[name]";?></td>
<td><?echo "$arr[owner]";?></td>
<td><?echo "$arr[species]";?></td>
</tr>
<?}?>
</table>
</form>
你的错误提示中TestDB_2.php on line 8 是mysql_select_db
而你的代码根本就不是
<head>
<title>Title here!</title>
</head>
<body>
<?php $conn=mysql_connect("localhost","root","821007");
mysql_select_db("test");
$sql="select * from pet";
$result=mysql_query($sql);
?><form name="form1" method="post" action="">
<table width="200" border="1">
<tr>
<td>Name</td>
<td>Owner</td>
<td>Species</td>
</tr>
<?php
while($arr=mysql_fetch_array($result))
{
?>
<tr>
<td><?echo "$arr[name]";?></td>
<td><?echo "$arr[owner]";?></td>
<td><?echo "$arr[species]";?></td>
</tr>
<?php
}?>
</table>
</form>
</body>
</html>
我新写了一个简单的,还是不行:<!doctype html public "-//W3C//DTD HTML 4.0 //EN">
<html>
<head>
<title>Title here!</title>
</head>
<body>
<?php
$conn = mysql_connect("localhost", "root", "pwd");
echo $conn;
mysql_close($conn);
?>
</body>
</html>结果:Warning: mysql_connect() [function.mysql-connect]: Client does not support authentication protocol requested by server; consider upgrading MySQL client in C:\Program Files\Apache Group\Apache2\htdocs\TestDB.php on line 8Warning: mysql_close(): supplied argument is not a valid MySQL-Link resource in C:\Program Files\Apache Group\Apache2\htdocs\TestDB.php on line 10
$link = mysql_connect('localhost', 'root', '821007') or die ('Not connected : ' . mysql_error());
Not connected : Client does not support authentication protocol requested by server; consider upgrading MySQL client我的mysql版本:5.1.20-beta
$conn = mysql_connect("127.0.0.1", "root", "pwd");
mysql 新旧版本密码算法不一致导致第一种解决方法:
mysql> SET PASSWORD FOR
-> 'some_user'@'some_host' = OLD_PASSWORD('newpwd');比方说数据库用户是admin,主机localhost,密码是123456这时候输入的命令应该是:mysql> SET PASSWORD FOR admin@localhost=OLD_PASSWORD('123456');第二种解决方法:mysql> UPDATE mysql.user SET Password = OLD_PASSWORD('newpwd')
-> WHERE Host = 'some_host' AND User = 'some_user';
mysql> FLUSH PRIVILEGES;
从网上一搜,答案大把大把的
FLUSH PRIVILEGES;