国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數據庫 > MySQL > 正文

關于 mysql5 改密碼后不能登錄問題的解答

2024-07-24 12:55:32
字體:
來源:轉載
供稿:網友

關于 mysql5 改密碼后不能登錄的問題
                                        felixsun
                                        2004-04-19
首先說明一下,下面描述僅限于win系統 其它系統我沒試過,

mysql 自從4.1.1以后修改了用戶密碼的格式, 從16位增加到了41位, 采用了一種新的驗證方法,

但4.1以前的客戶端協議不支持這種方法,所以造成了不能登臨的后果.
即使密碼正確了不能正常登錄,提示如下
#1250 - client does not support authentication protocol requested by server; consider upgrading mysql client


在窗口中執行:
c:/mysql/bin>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:/mysql/bin>mysqld-nt -old-password

在另一窗口中 運行
c:/mysql/bin>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

type 'help;' or '/h' for help. type '/c' to clear the buffer.

mysql> select password('mypassword');
+------------------------+
| password('mypassword') |
+------------------------+
| 162eebfb6477e5d3       |
+------------------------+
1 row in set (0.55 sec)

mysql>

可以看出password的結果又變成16位的了,可喜的變化, ,
[省略彎路若干..........]
我在c:/windows/my.ini (xp,98,中如此,2000中應在c:/wint/下)中的"mysqld"段中加入"set-variable=old-passwords"

例:
[mysqld]
basedir=c:/mysql
set-variable=old-passwords
datadir=c:/mysql/data
[winmysqladmin]
server=c:/mysql/bin/mysqld-nt.exe
user=root
password=mypassword

然后在服務管理器中起動mysql

very good, 一切正常,

后來我又發現,只要在mysql.user表中把password的字段長度改成16系統就自動切換到了oldpassword方式,改成改回41后 又自動換到了新的驗證方式.
在這里提醒一下,更改password方式后,要重新設制一下密碼并刷新一下權限(或重起mysql)

菜鳥學堂:
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 托克逊县| 新竹县| 松江区| 偏关县| 保德县| 五台县| 西安市| 贡嘎县| 巨野县| 扎赉特旗| 闸北区| 搜索| 清流县| 云阳县| 中宁县| 阜新| 和平区| 拉萨市| 澄城县| 宁陕县| 英山县| 石首市| 邹平县| 孝义市| 博野县| 湘西| 华容县| 长阳| 舒兰市| 定西市| 辉南县| 平顺县| 吴江市| 嘉善县| 罗定市| 奉新县| 南平市| 长汀县| 长顺县| 山西省| 巫溪县|