List databases and tables on MySQL server.

This is a sample script for getting information from MySQL. Before running the script, check if you have the MySql odbc driver installed.

'******************************************************************************
'** Script:       ListMySQL.vbs
'** Version:      1.0
'** Created:      12-8-2009 22:52
'** Author:       Adriaan Westra
'** E-mail:         
'**
'** Purpose / Comments:
'**               List databases and tables on MySQL.
'**
'**
'** Changelog :
'** date / time            : 
'** 12-8-2009 22:52  :   Initial version
'**
'******************************************************************************
'******************************************************************************
'** Database Access
Const adOpenKeyset = 1
Const adOpenDynamic = 2
Const adLockPessimistic = 2
Const adCmdText = 1
Const adCmdStoredProc = 4

Dim strConn, objRst, objTables, objConn
'******************************************************************************
'** Connection string for MySQL change Server, userid and password as needed
strConn  = "Provider=MSDASQL;" & _
    		  "Driver={MySQL ODBC 5.1 Driver};" & _
    		  "Server=dnsname or ipaddress;" & _
    		  "User ID=User;" & _
    		  "Password=password;"
'******************************************************************************
'** Open connection to server
Set objConn = CreateObject("ADODB.Connection")
objConn.open strConn
'******************************************************************************
'** Get the databases on the server
Set objRst = objConn.Execute("SHOW DATABASES",, adCmdText)
'******************************************************************************
'** Loop through the databases
While not objRst.EOF
'******************************************************************************
'** Display information
   Wscript.echo objRst.Fields(0).name & " : " & objRst.Fields(0)
'******************************************************************************
'** Get the tables in the database
   Set objTables = objConn.Execute("SHOW TABLES FROM " & objRst.Fields(0),, adCmdText)
   While not objTables.EOF
         Wscript.echo "   " & objTables.Fields(0).name & " : " & objTables.Fields(0)
         objTables.MoveNext
   Wend
'******************************************************************************
'** Get next record
  	objRst.movenext
Wend
Wscript.Quit(0)