關於mysql5 改密碼後不能登入_PHP教程

來源:互聯網
上載者:User
首先說明一下,下面描述僅限於Win系統 其它系統我沒試過,Mysql 自從4.1.1以後修改了使用者密碼的格式, 從16位增加到了41位, 採用了一種新的驗證方法,但4.1以前的用戶端協議不支援這種方法,所以造成了不能登臨的後果.即使密碼正確了不能正常登入,提示如下:
  #1250 - Client does not support authentication protocol requested by server; consider upgrading MySQL client
  
  在視窗中執行:
  C:mysqlin>mysql -uroot
  Welcome to the MySQL monitor. Commands end with ; or g.
  Your MySQL connection id is 1 to server version: 5.0.0-alpha-nt
  
  Type 'help;' or 'h' for help. Type 'c' to clear the buffer.
  
  mysql> select password('aa');
  +-------------------------------------------+
  | password('aa')              |
  +-------------------------------------------+
  | *DEE59C300700AF9B586F9F2A702231C0AC373A13 |
  +-------------------------------------------+
  1 row in set (0.00 sec)
  
  mysql>
  從上可以看出password的結果返回了一個以'*'號開頭的41位字串,而以前是16位的.
  
  Mysql官方網站給出了二種解決方案
  
  1,使用新的用戶端api,
  2,強制服務器使用舊的密碼方案
  
  我首先嘗試了第一種方法,從mysql5.0中拷貝libmysql.dll到php 的擴充目錄中,替代了php本身附帶的libmysql.dll, 但結果令人失望. Php提示裝入php_mysql.dll失敗:PHP Warning: PHP Startup: Unable to load dynamic library 'c:/php5/ext/php_mysql.dll' - 找不到指定的程式。後來發現新版的dll中缺少了mysql_drop_db() 這一函數 :( 只有等php或mysql出更新的dll了.
  
  第一種方法行不通,只有試試第二種方法,mysql的官方FAQ中說,需要加上-old-password這一參數,我首先嘗試 在命令列下起動mysql,
  c:mysqlin>mysqld-nt -old-password
  
  在另一視窗中 運行
  C:mysqlin>mysql -uroot
  Welcome to the MySQL monitor. Commands end with ; or g.
  Your MySQL connection id is 540 to server version: 5.0.0-alpha-nt

http://www.bkjia.com/PHPjc/631119.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/631119.htmlTechArticle首先說明一下,下面描述僅限於Win系統 其它系統我沒試過,Mysql 自從4.1.1以後修改了使用者密碼的格式, 從16位增加到了41位, 採用了一種新的驗證...

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.