关于MySql的连接问题(50分)

  • 主题发起人 主题发起人 poto5269
  • 开始时间 开始时间
P

poto5269

Unregistered / Unconfirmed
GUEST, unregistred user!
想用MySql做为后台服务器,局域网中的其它用户通过客户端进行数据访问。<br>MySql版本为5.0.41,安装MyODBC-standard-3.51.07-win驱动。<br>问题1:为什么在ODBC中创建数据源时出现“Client does not support authentication protocol....”错误提示?通过网上查找,最后用mysql&gt; SET PASSWORD FOR <br>&nbsp; &nbsp;-&gt; 'some_user'@'some_host' = OLD_PASSWORD('newpwd')<br>解决了。我在配置中Host/Server Name(Or IP)中输入的是localhost,但一改成本机IP地址就又出现了上述错误,是什么原因啊?<br>问题2:让客户端能连接数据库是不是都得在每台机上安装MyODBC驱动并进行手工配置,这样不是太麻烦了吗?有什么简单的办法呢?最好不用配置,呵呵<br>第一次接触MySql,还请各位帮一下啊
 
想避免麻烦只有找个mysql 4.0做服务器
 
但为什么我Host中只能输localhost,不能写我的IP:192.168.10.88呢?
 
http://blog.chinaunix.net/u1/46962/showart_373173.html?
 
问题2,如果不想手动配置,可以事先做好注册表。双击就好了。或者Delphi自己写注册表。<br><br>注册表配置ODBC的详细例子 <br>提交日期:2003-11-20 &nbsp;<br>&nbsp;<br>关键词:ODBC 注册表 &nbsp;<br>【思路】:先在ODBC中配置然后到注册表中去看有什么增加,然后照样写进去就可以了,但是这样做有一个问题,SQL Server默认是用命名管道,如果要用TCP/IP协议请在注册表中找1433,就能找到它是在那里.照样写进去就OK了。<br>var<br>&nbsp;reg : TRegistry;<br>begin<br>&nbsp;reg := TRegistry.Create;<br>&nbsp;//建立一个Registry实例<br>&nbsp;with reg do<br>&nbsp;begin<br>&nbsp; &nbsp; RootKey:=HKEY_LOCAL_MACHINE;<br>&nbsp; &nbsp; //设置根键值为HKEY_LOCAL_MACHINE<br>&nbsp; &nbsp; //找到Software/ODBC/ODBC.INI/ODBC Data Sources<br>&nbsp; &nbsp; if OpenKey('Software/ODBC/ODBC.INI/ODBC Data Sources' True) then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; //注册一个DSN名称<br>&nbsp; &nbsp; &nbsp; &nbsp; WriteString( 'DSN' &nbsp;'SQL Server' );<br>&nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; //创建键值失败<br>&nbsp; &nbsp; &nbsp; &nbsp; ShowMessage('增加ODBC数据源失败');<br>&nbsp; &nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; &nbsp; end;<br>&nbsp; &nbsp; CloseKey;<br>//找到或创建Software/ODBC/ODBC.INI/masdsn 写入DSN配置信息<br>&nbsp; &nbsp; if OpenKey('Software/ODBC/ODBC.INI/DSN' True) then<br>&nbsp; &nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; &nbsp; WriteString( 'Driver' &nbsp;'C:/Windows/System/sqlsrv32.dll' );<br>&nbsp; &nbsp; &nbsp; &nbsp; WriteString( 'LastUser' &nbsp;'Username' );<br>&nbsp; &nbsp; &nbsp; &nbsp; WriteString( 'Password' &nbsp;'password' );<br>&nbsp; &nbsp; &nbsp; &nbsp; WriteString( 'Server' &nbsp;'ServerName' );<br>&nbsp; &nbsp; &nbsp; end<br>&nbsp; &nbsp; else<br>&nbsp; &nbsp; //创建键值失败<br>&nbsp; &nbsp; begin<br>&nbsp; &nbsp; &nbsp; Showmessage('增加ODBC数据源失败');<br>&nbsp; &nbsp; &nbsp; exit;<br>&nbsp; &nbsp; end;<br>&nbsp;CloseKey;<br>&nbsp;Free;<br>&nbsp;ShowMessage('增加ODBC数据源成功');<br>end;<br>&nbsp; &nbsp;<br>//以上程序是写到system里的,当然同样可以写到当前用户里!
 
Windows Registry Editor Version 5.00<br><br>[HKEY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBC.INI/colds]<br><br>---------------------------------------------<br><br>'将下面的盘符改成Windows2000/XP的盘符及路径<br>"Driver"="C://WINNT//System32//SQLSRV32.dll"<br><br>---------------------------------------------<br>"Description"="学校网络信息查询系统数据库"<br>"Server"="(local)"<br>"Database"="college"<br>"LastUser"="coldba"<br>"Trusted_Connection"="Yes"<br><br>[HKEY_LOCAL_MACHINE/SOFTWARE/ODBC/ODBC.INI/ODBC Data Sources]<br>"colds"="SQL Server"
 
后退
顶部