Skip to content

Getting the MySQL Server Version

Do you need to know what version of MySQL you’re using in code? Maybe you need one of the many other configuration parameters that MySQL offers? It’s easy to get this information with some simple code!

Dim db As New MySQLCommunityServer

db.Host = "somehost"
db.port = <port # for your mysql server>
db.DatabaseName = "somedbname"
db.UserName = "someuser"
db.Password = "somepassword"

If db.Connect Then

  Dim rs As RecordSet = db.SQLSelect("select @@Global.version")

  While rs <> Nil And rs.eof <> True

    // and here you get a row with the value selected

    rs.MoveNext

  Wend
End If

There are a whole host of possible items you can select this way.  See all your options at the MySQL Docs site.