MYSQL Server Connection

  1. 2 weeks ago

    Pathma M

    Oct 12 Pre-Release Testers, Xojo Pro
    Edited 2 weeks ago by Pathma M

    wamp installed with port 81, here is my code
    But Database was not connected.
    Kindly advice what am missing?

    MYSQL = New MySQLCommunityServer
    Dim n As NetworkInterface
    n = System.GetNetworkInterface
    MYSQL.Host = n.IPAddress
    MYSQL.Port = 81
    MYSQL.UserName = "root"
    MYSQL.Password = "12345"
    MYSQL.DatabaseName = "db_test"

    If MYSQL.Connect Then
    mIsConnected = True
    lbl_MYSQL_Status.Text = "MYSQL DB CONNECTED"
    Else
    mIsConnected = False
    lbl_MYSQL_Status.Text ="MYSQL DB NOT CONNECTED"
    End If

    FYI

    I can open mannually with "localhost:81/phpmyadmin"

  2. Sascha S

    Oct 12 Pre-Release Testers, Xojo Pro Germany/W'haven

    @Pathma M MYSQL.Host = n.IPAddress

    Try to replace MYSQL.Host = n.IPAddress with MYSQL.Host = "127.0.0.1"

  3. Tim H

    Oct 12 Pre-Release Testers Portland, OR USA

    MySql makes a distinction between "localhost" and "127.0.0.1". They are not the same. Root access is usually limited to 127.0.0.1. "localhost" doesn't work.

  4. Eli O

    is not verified Oct 12 Europe (Berlin, Germany)

    The port number is probably wrong. If I recall correctly (I am mostly on macOS now) WAMP uses 81 for PHPMyAdmin. The MySQL port is 3306. So this should work:

    db.Database = localhost
    db.Port = 3306

or Sign Up to reply!