Installing mysql silently and configure mysql using vbscript RRS feed

  • Question

  • I have been working with but I'm new to vbscript.  Please can someone help me out.  

    I'm try to code vbscript to can help me to silently install mysql, install mysql service and setup root password. below are my code:

    echo off
    set objShell=wscript.createObject("")
    Wscript.Echo "Starting Install..."

    set mysql_msi="C:\Mysql\mysql-essential-6.0.10-alpha-win32.msi"
    set mysql_svname=MySQL
    set mysql_odbc="C:\Mysql\mysql-connector-odbc-3.51.27-win32.msi"
    set mysql_gui="C:\Mysql\mysql-gui-tools-5.0-r17-win32.msi"
    set mysql_datadir="C:\Documents and Settings\All Users\Application Data\MySQL\MySQL Server 6.0\data"
    set mysql_data2="C:\Program Files\MySQL\MySQL Server 6.0\data"
    set mysql_cmd="GRANT ALL PRIVILEGES ON *.* TO 'root'@'%' IDENTIFIED BY 'mysql' WITH GRANT OPTION;"
    set mysql_inst="msiexec /i %mysql_msi% /qn"

    Wscript.Echo "MySQL Version 6.0.7 installed..."
    rem md %mysql_data2%

    objShell.Run("C:\Program Files\MySQL\MySQL Server 6.0\bin\mysqlinstanceconfig.exe" -i -q ServiceName=MySQL RootPassword=mysql ServerType=DEVELOPMENT DatabaseType=MYISAM Port=3306 RootCurrentPassword=mysql)
    Wscript.echo "MySQL Instance Configured...Service started..."

    rem Uncomment next line to allow root access from any pc...
    "C:\Program Files\MySQL\MySQL Server 6.0\bin\mysql.exe" -uroot -pmysql -e %mysql_cmd%

    msiexec /qn /i %mysql_odbc% /L* C:\MSI-MySQL-ODBC-Log.txt
    echo ODBC Connector installed...

    msiexec /qn /i %mysql_gui% /L* C:\MSI-MySQL-GUI-Log.txt
    Wscript.Echo "MySQL GUI Tools installed..."

    echo on

    explorer "C:\Program Files\MySQL\MySQL Server 6.0\bin"


    • Changed type Reed KimbleMVP Saturday, January 20, 2018 2:08 PM asks a question
    • Moved by Reed KimbleMVP Saturday, January 20, 2018 2:09 PM VBS in VB.Net
    Saturday, January 20, 2018 3:09 AM

All replies

  • Hi, you've posted to the VB.Net forum.  I will move this to a scripting forum since it is a question about VB script.

    Reed Kimble - "When you do things right, people won't be sure you've done anything at all"

    Saturday, January 20, 2018 2:09 PM
  • Why are you obfuscating your code when asking for help.

    Lose all the variables. They are unnecessary and obfuscating. We aim to write clear code that should be self documenting.

    David Candy

    Saturday, January 20, 2018 10:33 PM