`
happy20070302
  • 浏览: 95357 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

asp连接mysql

    博客分类:
  • ajax
阅读更多
1 安装MyODBC-3.51.06.exe
2 控制




测试一下:
3
错误MySQL 返回:
#1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

出现这种问题也只有在MYSQL4.1.x以上版本,用4.0.x就没问题了。我服务器是mysql5.0

上网找到了原因,并且试验成功了。

原因是因为使用的mysql服务器版本中使用了新的密码验证机制,这需要客户端的版本要在4.0以上,原来的密码函数被改为old_password ();,这样使用password()生成的密码在旧的版本上的客户端就不好使了,而PHP中的MYSQL客户端都是3.23的(当然,mysqli的扩展除外),问题就在这了。

目前已知解决方法:

1、进入命令行下,转到MYSQL目录的BIN目录下,进入MYSQL命令行模式:
例:(用户root,密码123)
2、输入命令:

mysql>set password for 'root'@'localhost'=old_password('123');(注意冒号不能少)
3、退入MYSQL命令行:
mysql>q


测试文件:
<html>

<head>

<title>MySQL连接测试</title>

<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

</head>

<body>

<%

strconnection="dsn=link;driver={mysql odbc 3.51 driver};server=localhost;uid=root;pwd=root;database=QQ"

set conn = server.createobject("adodb.connection")

conn.open strconnection

sql = "select * from kefu_inf" 

set rs = conn.execute(sql)

if not rs.bof then

%>

<table width="167">

<tr>

<td width="76"><b>name</b></td>

<td width="79"><b>sex</b></td>

</tr>

<%

do while not rs.eof

%>

<tr>

<td><%=rs("kefu_id")%></td>

<td><%=rs("kefu_name")%></td>

</tr>

<%

rs.movenext

loop

%>

</table>

<%

else

response.write("sorry, no data found.")

end if

rs.close

conn.close

set conn = nothing

set rs = nothing

%>

</body>

</html>

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics