<><FONT color=#f70909>来源:LinuxAid</FONT> </P>2 [. K) R6 Y; h" T5 x3 [
<>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>$ z: k) F- q3 E1 \% ^" ^
<> 1Upgrade all client programs to use a 4.1.1 or newer client library. </P> 5 W. q. O' P, _, R/ u" ?( ?<> 更新客户端库,这需要更新PHP的扩展库,对于老的api PHP已经不提供了这样的扩展库了 </P> ' a5 L! R O) z# a& _<> 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># t5 R, o+ V' c! o* [
<> 使用以前建立的账号连接,对于在新的认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>下建立的<a href="http://hackbase.com/skill" target="_blank" >账户</A>就不行了 </P> 9 y. @! R; R7 W( \" P7 t% 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>> SET PASSWORD FOR </P>- ?9 V! x& x! D" v+ \
<> -> <a href=" target="_blank" >_</A>user'@'some<a href="http://www1.hackbase.com/network/server/200501209617.htm#" target="_blank" >_</A>host'">'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> " b. q0 Q0 ~- i" t7 X; H" \<> Alternatively, use UPDATE and FLUSH PRIVILEGES: my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>> 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') -> 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>. @: `) g0 X+ i$ l
<> my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>> FLUSH PRIVILEGES; </P>& c) a N+ S( `4 a( z
<> 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> ! r @0 r' ~# F, @7 g* x0 m<> 这是一个不错的办法,新建立的账号采用老式的加密<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A> </P>0 T# ^% q3 g6 c/ K( t: \
<> 4Tell the server to use the older password hashing algorithm: </P>6 A9 B' @0 i( t1 \8 a6 l% s8 Q$ V
<> Start my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>d with the --old-passwords option. </P> * N, n% O3 \# U7 J8 E6 \<> 这样新认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>的优点就没法使用了 </P>9 r% K" w* e8 g9 C1 j
<> 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>> SELECT Host, User, Password FROM my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>.user </P>7 M: W1 t$ |9 N. _0 [( I
<> -> WHERE LENGTH(Password) > 16; </P> . T% K" A7 A# I<> 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>7 H6 g) C+ T. q' f8 M4 a% v
<> 恢复已经升级了口令到老样式 </P>1 a5 E6 n I2 B4 r& U- x" f; ]
<> 本文参照了 <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">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>1 l3 E5 O5 b% g. U9 k
<> : [, P6 x: W5 {# n* O: ]<CENTER></CENTER>