数学建模社区-数学中国

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

作者: 韩冰    时间: 2005-1-20 14:49
标题: PHP 5 连接 mysql 5的认证协议问题
<><FONT color=#f70909>来源:LinuxAid</FONT> </P>: ~0 t7 ], Z" f# H) K, {
<>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>
+ l0 M1 T5 H+ [5 E<>  1Upgrade all client programs to use a 4.1.1 or newer client library.    </P>
: V0 ]( p- i  U! Y/ ]<>  更新客户端库,这需要更新PHP的扩展库,对于老的api PHP已经不提供了这样的扩展库了    </P>; W1 _9 J; d: @% D! {, E! i
<>  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>4 O* b7 `2 y3 F1 M8 ?
<>  使用以前建立的账号连接,对于在新的认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>下建立的<a href="http://hackbase.com/skill" target="_blank" >账户</A>就不行了    </P>8 P, N/ X+ s, f. D* ?. R* {
<>  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>
. }  @" Q: l) `, a- b<>  -&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>% S  z9 ]2 O% l5 p9 O. S- L
<>  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>
7 r7 w" T+ ~% l/ k0 S<>  my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>&gt; FLUSH PRIVILEGES;    </P>
, \3 i7 K! W. j0 V0 ?<>  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>0 _/ Z  t4 e* v6 {6 S, q* S. U( f
<>  这是一个不错的办法,新建立的账号采用老式的加密<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>    </P>
; Y( P1 @8 K! B) ^<>  4Tell the server to use the older password hashing algorithm: </P>
* J% T) f: {$ k- B6 V<>  Start my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>d with the --old-passwords option.   </P>
8 I6 u) t$ Z$ T: s<>  这样新认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>的优点就没法使用了    </P>
0 i0 @% H5 F! Z: d<>  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>: J; W3 P4 o6 {) S2 t( w# s" z
<>  -&gt; WHERE LENGTH(Password) &gt; 16;    </P>1 S0 R  E& y- b  K$ M! h$ J6 a
<>  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>
; t6 R8 \& }% j" a8 W+ u<>  恢复已经升级了口令到老样式    </P>
% T4 y9 S( C3 d<>  本文参照了 <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>- s6 B  o( k3 t8 v! r5 z" W! ~
<>0 T+ t& X6 i. _" t
<CENTER></CENTER>




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