Did you know you can start and stop the MySQL server from with in VB? To do this all you have to use is the Shell command. If you have an application that uses MySQL then you can add code to the Form_Load and Form_Unload to start and stop the MySQL server.

Private Sub Form_Load()
Dim RetVal
RetVal = Shell("C:\mysql\bin\mysqld", 0) 'Start MySQL
End Sub

Private Sub Form_Unload(Cancel As Integer)
Dim RetVal
RetVal = Shell("C:\mysql\bin\mysqladmin -u root shutdown", 0) 'Stop MySQL
End Sub

The second argument in the Shell Function is the windowstyle, we use zero(0) so
the DOS window will not pop up when the server starts so it's started and stopped
in the back ground.

The Shell function Windowstyle has the following constants.

vbHide 0 Window is hidden and focus is passed to the hidden window.

vbNormalFocus 1 Window has focus and is restored to its original size and position.

vbMinimizedFocus 2 Window is displayed as an icon with focus.

vbMaximizedFocus 3 Window is maximized with focus.

vbNormalNoFocus 4 Window is restored to its most recent size and position. The currently active window remains active.

vbMinimizedNoFocus 6 Window is displayed as an icon. The currently active window remains active.