Hafiz Abdullah
Hafiz Abdullah

Reputation: 248

MySQL connection string error

So I've port forward phpMyAdmin in order to access it from another network and it worked. I can access it from my browser by typing in xxx.xxx.com:8080. My problem is my program which I developed using VB.NET cannot establish a connection with the database(phpMyAdmin).

   Dim ServerString As String = "Server=xxx.xxx.com,8080;Database=hresource;Uid=trade;Pwd=1234"

      SQLConnection.ConnectionString = ServerString

    Try
        If SQLConnection.State = ConnectionState.Closed Then
            SQLConnection.Open()
             MsgBox("Succesfully Connected to MySQL Database.")
        Else
            SQLConnection.Close()
            MsgBox("Connection is Closed")

        End If
    Catch ex As Exception
        MsgBox(ex.ToString)

    End Try
    SQLConnection.Close()
    SQLConnection.Dispose()

It give off error when trying to open the connection.

Upvotes: 0

Views: 384

Answers (1)

lc.
lc.

Reputation: 116448

phpMyAdmin is not what you want to port-forward; it is the MySQL server itself.

phpMyAdmin is simply a front-end administration tool human users can utilize from a browser, which acts as an intermediary between you and the database server. VB.NET however is expecting to connect directly to the database, and doesn't know anything about phpMyAdmin.

Upvotes: 2

Related Questions