数学建模社区-数学中国

标题: PHP 5 连接 mysql 5的认证协议问题 [打印本页]

作者: 韩冰    时间: 2005-1-20 14:49
标题: PHP 5 连接 mysql 5的认证协议问题
<><FONT color=#f70909>来源:LinuxAid</FONT> </P>
! P% c  T# Z, W/ v7 t<>MYSQL 4.1以后, 采用了一种新的用户认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>, 对于老的客户端会出现不支持认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>的错误, 以下是官方网站的解决方法 r    </P>
# {, l; y+ e- {: T$ a: ~# {- y<>  1Upgrade all client programs to use a 4.1.1 or newer client library.    </P>
7 ?$ R8 t4 H* q1 c& _! f; p& z; `<>  更新客户端库,这需要更新PHP的扩展库,对于老的api PHP已经不提供了这样的扩展库了    </P>
+ ]' {. d  d% n; g* [) d# z' |( n<>  2When connecting to the server with a pre-4.1 client program, use an account that still has a pre-4.1-style password.    </P>
3 X8 }9 A* M& S+ W* m# L! u$ u  w) P<>  使用以前建立的账号连接,对于在新的认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>下建立的<a href="http://hackbase.com/skill" target="_blank" >账户</A>就不行了    </P>* |% q2 I; Z3 ?
<>  3Reset the password to pre-4.1 style for each user that needs to use a pre-4.1 client program. This can be done using the SET PASSWORD statement and the OLD<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>ASSWORD() function: my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>&gt; SET PASSWORD FOR </P>
6 {6 A0 d3 ^1 `5 Y: H1 _& t  W5 b* X% {<>  -&gt; <a href=" target="_blank" >_</A>user'@'some<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>host'"&gt;'some<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>user'@'some<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>host'</A> = OLD<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>ASSWORD('newpwd');    </P>6 _. s: W# \! S; ]0 Z6 B/ z& m
<>  Alternatively, use UPDATE and FLUSH PRIVILEGES: my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>&gt; UPDATE my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>.user SET Password = OLD<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>ASSWORD('newpwd') -&gt; WHERE Host = 'some<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>host' AND User = 'some<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>user'; </P>2 F0 r7 d$ R6 m' s2 l
<>  my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>&gt; FLUSH PRIVILEGES;    </P>3 S- r6 ]8 v. Q( X7 J1 z4 F
<>  Substitute the password you want to use for ``newpwd'' in the preceding examples. MySQL cannot tell you what the original password was, so you'll need to pick a new one.   </P>! q$ Y' z2 A1 ^. P3 c7 X! k- J
<>  这是一个不错的办法,新建立的账号采用老式的加密<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>    </P>4 ~. ^9 r% x; R9 v4 n
<>  4Tell the server to use the older password hashing algorithm: </P>
1 _1 f- }2 r( G# Q. p<>  Start my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>d with the --old-passwords option.   </P>
2 {/ H$ H7 L0 ~. C6 p7 \: ^+ o0 q<>  这样新认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>的优点就没法使用了    </P>
9 Z; n$ j$ I2 Z<>  5Assign an old-format password to each account that has had its password updated to the longer 4.1 format. You can identify these accounts with the following query: my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>&gt; SELECT Host, User, Password FROM my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>.user </P>
  u" X7 z% [' w% X. T<>  -&gt; WHERE LENGTH(Password) &gt; 16;    </P>* a0 X& D2 w8 l+ e2 G8 ]. D* s: y
<>  For each account record displayed by the query, use the Host and User values and assign a password using the OLD<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>ASSWORD() function and either SET PASSWORD or UPDATE, as described earlier.    </P>
* z* c, j& a* e9 E( I<>  恢复已经升级了口令到老样式    </P>- X, q  O; H3 K- Z3 M
<>  本文参照了 <a href="http://dev.my<a%20href=/" target="_blank" >sql</A>.com/doc/my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>/en/Old<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>client.html"&gt;http://dev.my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>.com/doc/my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>/en/Old<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>client.html</A> </P>% l4 ]7 O* J7 B  ]; m
<>
, i* ?/ m6 M$ g$ j& \- k- {2 Y<CENTER></CENTER>




欢迎光临 数学建模社区-数学中国 (http://www.madio.net/) Powered by Discuz! X2.5