
首先说明一下,下面描述仅限于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)
#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)
推荐阅讯
- MySQL 5.0.16 乱码问题处理办法
- 采用ODBC接口访问MySQL指南
- 从MySQL到ORACLE程序迁移的注意事项
- 在ACCESS 中调用后台存储过程
- MySQL中文参考手册-- 连接与断开服务者
- MySQL for Linux (x86, libc6) 下载列表
- MySQL的DBI/DBD简明安装手册
- 通过Mysql的语句生成后门木马的方法
- MySQL for Linux (x86, glibc-2.2, static,
- Mysql中的临时表使用方法讲解
阅读排行
- 1.完整图解 Tomcat 5.0.28 安装笔记
- 2.Tomcat+SQL Server2000连接池配置
- 3.MySQL 5.015官网下载地址
- 4.MySQL Client下载列表
- 5.MySQL数据库如何实现双机热备的配置
- 6.JDBC连接SQL2000详细流程
- 7.MySQL for Linux (x86, glibc-2.2, static,
- 8.MySQL数据库的多表操作和备份处理
- 9.一个简便的MySql数据库备份的方法
- 10.MySQL数据查询器下载列表
专题教程
- 大话G游 专题:手机病毒揭密
- ARP攻击防范与解决方案 路由故障处理手册
- Picasa中文版_Picasa教程 专题:清除流氓软件
- Firefox专题 seo搜索引擎优化专区
- 重装Windows必知的事情 装机之必备软件大行动
病毒专杀栏
