<><FONT color=#f70909>来源:LinuxAid</FONT> </P>' @" `0 D; b; S* J9 B
<>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> 5 W- x1 E9 U4 |3 F<> 1Upgrade all client programs to use a 4.1.1 or newer client library. </P> 4 V& S' D# K7 Z. }<> 更新客户端库,这需要更新PHP的扩展库,对于老的api PHP已经不提供了这样的扩展库了 </P> 3 i" t" ]0 x1 F w0 G1 Q* @<> 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>* D/ J5 B9 b. k0 Z
<> 使用以前建立的账号连接,对于在新的认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>下建立的<a href="http://hackbase.com/skill" target="_blank" >账户</A>就不行了 </P>" A7 l' z9 c+ J9 p! a9 o8 q3 ^7 u/ B! x3 G
<> 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>3 ^# n/ t. L6 q4 @! h$ m2 M
<> -> <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>2 Q* {5 w7 Z8 y: x
<> 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> 2 J# X8 G5 n+ K<> my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>> FLUSH PRIVILEGES; </P> 2 `: E2 w. ^- c<> 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>% k- f% W7 V; Y' b
<> 这是一个不错的办法,新建立的账号采用老式的加密<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A> </P> ( b* w# L r6 o4 j: X A<> 4Tell the server to use the older password hashing algorithm: </P> 1 I: ^; R0 M7 Q8 R; }6 _2 |: H<> Start my<a href="http://hackbase.com/hacker" target="_blank" >sql</A>d with the --old-passwords option. </P> 0 m0 C: s8 R$ y% l<> 这样新认证<a href="http://hackbase.com/network/protocol" target="_blank" >协议</A>的优点就没法使用了 </P>6 `# I% i* g$ Y" v8 x
<> 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>" {( J# K' ]" D- \) f
<> -> WHERE LENGTH(Password) > 16; </P> j" S2 C! ]1 y. C
<> 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>& z6 U& e: C- W( t" y7 ~8 D
<> 恢复已经升级了口令到老样式 </P> 7 t/ i E* P9 h& v# E<> 本文参照了 <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>0 a6 u4 s+ ^( l6 Z0 h0 ~2 ^5 i0 z
<>% c% p1 D! k9 O4 Y
<CENTER></CENTER>