Home >Database >Mysql Tutorial >vb连接MySQL遇到的问题解决方法

vb连接MySQL遇到的问题解决方法

WBOY
WBOYOriginal
2016-06-07 16:51:511217browse

1.安装mysql,2.安装MyODBC-standard-3.51.07-win.msi3:vb连接语句是:Public strcnn As StringPublic sql As StringPublic conn A

1.安装mysql,

2.安装MyODBC-standard-3.51.07-win.msi

3:vb连接语句是:

Public strcnn As StringPublic sql As String

Public conn As New ADODB.Connection

Public rs As New ADODB.Recordset

Sub link()

strcnn = "driver={MySQL ODBC 3.51 Driver};server=localhost;database=data;uid=root;pwd=zjb"conn.Open strcnn

End Sub

错误MySQL 返回: #1251 - Client does not support authentication protocol requested by server; consider upgrading MySQL client

出现这种问题也只有在MYSQL4.1.x以上版本,用4.0.x就没问题了。

原因是因为使用的mysql服务器版本中使用了新的密码验证机制,这需要客户端的版本要在4.0以上,原来的密码函数被改为old_password ();,这样使用password()生成的密码在旧的版本上的客户端就不好使了,而PHP中的MYSQL客户端都是3.23的(当然,mysqli的扩展除外),问题就在这了。

1、进入命令行下,转到MYSQL目录的BIN目录下,进入MYSQL命令行模式:

例:d:\mysql\bin>mysql -uroot -p123 用户root,,密码123)

2、输入命令:mysql>set password for 'root'@'localhost'=old_password('123'); (注意冒号不能少)

3、退入MYSQL命令行:mysql>q

ok

linux

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn