试图从 .asp 页面连接到远程 mysql

trying to connect to remote mysql from .asp page(试图从 .asp 页面连接到远程 mysql)

本文介绍了试图从 .asp 页面连接到远程 mysql的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试从经典 ASP 页面连接到远程 MySQL 数据库,当我在其中编写 VBScript 代码时,网站给出 HTTP 500 Internal Server 错误.我与主人核实过,他们说这不是他们的错误.

I am trying to connect to a remote MySQL database from Classic ASP page, when I write VBScript code in it the website is giving HTTP 500 Internal Server Error. I checked with the host they are saying its not an error from their end.

请帮帮我.

<%
dim myConnection
dim connectString

username = "bla"
password = "bla"
database = "bla"
host = "bla"

Set myConnection = Server.CreateObject("ADODB.Connection")
Set RSTitleList = Server.CreateObject("ADODB.Recordset")

connectString = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER="&host&"; DATABASE="&database&"; UID="&username&";PASSWORD="&password&"; OPTION=3"

**myConnection.Open connectString   ---- HERE I'M GETTING ERROR. ABOVE CODE IS WORKING FINE.**

Set RSTitleList =  myConnection.Execute( "Select * From questions") %>


<!-- Begin our column header row -->  

<!-- Ok, let's get our data now -->
<% do while not RStitleList.EOF %>   
   <p>           <%=RStitleList("id")%>).

             <b><%=RSTitleList("question") %></b>  &nbsp&nbsp&nbsp&nbsp <%=RSTitleList("answer") %> <!--<a href="emailaddress.htm">-->More&#9658;<!--</a>--> <br>
             <p>&nbsp&nbsp&nbsp&nbsp <font color="purple"> answered by </font> <b>Sadhu</b> on 1-10-2015 </p>   
    </p>


   <% RSTitleList.MoveNext%>

<%loop %>

推荐答案

好的,你已经找到了底层错误信息(在服务器上).谢谢你.这很重要:

OK, you've found the underlying error message (on the server). Thank you. It's important:

 [MySQL][ODBC 3.51 Driver]Access denied for user 'bla'@'162.253.126.112' (using password: YES) 

由于您收到拒绝访问",并且由于 MySQL 身份是用户名 + 主机的组合,因此这意味着以下三件事之一:

Since you're getting "access denied", and since a MySQL identity" is a combination of username + host, this means one of three things:

  1. 您传递给 mySQL 的用户名错误...

  1. You're passing mySQL the wrong username...

...和/或您正在从尚未被授予访问权限的主机登录...

... And/or you're logging in from a host that hasn't been granted access...

... 和/或您向 mySql 传递了错误的密码

... And/or you're passing mySql the wrong password

通常,排除故障的最佳方法是使用 mysql 命令行客户端.我猜这可能不适合你.

Normally, the best way to troubleshoot would be with the mysql command-line client. I'm guessing this is probably not an option for you.

另一种方法可能是控制面板 > ODBC > 测试连接:

Another way might be Control Panel > ODBC > Test Connection:

  • 在 Windows 上测试 ODBC 的最简单方法

但是,如果您的 IIS 网络服务器和 MySQL 数据库位于远程服务器(而不是本地)上,这也可能不是一个选项.

But this might not an option either, if your IIS webserver and MySQL database are co-located on the remote server (instead of local).

以下是解决 mySQL 用户名/密码问题的其他一些建议:

Here are some other suggestions for troubleshooting your mySQL username/password:

  • MySQL 错误 1045 (28000):用户'bill'@'localhost'的访问被拒绝(使用密码:YES)

MySQL - 错误 1045 - 访问被拒绝

1045 拒绝用户访问 - MySQL 错误

您还可以与您的托管服务提供商合作,验证您用于验证 mySql 的用户名 + 主机 + 密码的组合.

You can also work with your hosting provider to verify the combination username + host(s) + password you're using to authenticate to mySql.

这篇关于试图从 .asp 页面连接到远程 mysql的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本文标题为:试图从 .asp 页面连接到远程 mysql