How to Restore ConnectWise Automate Database
- SankalpIT
- August 17, 2020
- Documentation
- 0

SankalpIT – Plugins for Automate
You must be interested to know how ConnectWise Automate does the backup of database.
See screenshot.
Note :
See screenshot.
Stop ConnectWise Automate Critical services
Open to C:\Program Files (x86)\LabTech\mysql\data folder and delete the following log files and a folder.
labtech (a folder).
ibdata1, ib_logfile0 and ib_logfile1 log files.
Re-create ConnectWise Automate database
Before proceeding further, Please make sure LabMySQL is running. If not, open the command prompt and run the following command.
Download File: Start LabMySQL Service.bat net start LabMySQL
Now, you need to drop “ConnectWise Automate” database and create it again.Use the following batch script to recreate MySQL database called “LabTech”. Replace ProvideYourPasswordHereWithoutQuotes with root password in the following script.
Download File: Drop and Create LabTech Database.bat
@echo off
SET rootuser=root
SET rootPassword=ProvideYourPasswordHereWithoutQuotes
SET MySQLexe=”c:\program files (x86)\labtech\mysql\bin\mysql.exe”
%MySQLexe% –user=%rootuser% –password=%rootPassword% –execute=”drop database labtech;”
Echo ……………….Dropped ConnectWise Automate Database………………
Echo.
pause > nul
Echo ……………….Creating ConnectWise Automate Database……………….
Echo.
%MySQLexe% –user=%rootuser% –password=%rootPassword% –execute=”create database ConnectWise Automate;”
Echo ConnectWise Automate Database has been created successfully……………….
echo.
pause > nul
Import ConnectWise Automate database structure
After re-creating database, you need to import MySQL “Tables”, “Views”, “Triggers” and “Procedures” into database. Use the following batch script.
Download File:
Import Structure to Database.bat
@echo off
SET rootuser=root
SET rootPassword=ProvideYourPasswordHereWithoutQuotes
SET MySQLexe=”c:\program files (x86)\labtech\mysql\bin\mysql.exe”
SET sourceFolder=%USERPROFILE%\Desktop\Labtech.1
%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseTable.sql”
echo.
Echo ……………….Imported LabTech Tables structure………………
Echo.
%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseViews.sql”
echo.
Echo ……………….Imported LabTech Views………………
Echo.
%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseTrigger.sql”
echo.
Echo ……………….Imported LabTech Triggers………………
Echo.
%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\DBaseProc.sql” echo. Echo ……………….Imported LabTech Procedures……………… Echo. Echo ——————— Press any key to Exit———————- Pause > nul
Import ConnectWise Automate Database data
Now, we need to import data in LabTech database. Use the following batch script for that.
Download File: Import Data to Database.bat
@echo off
SET rootuser=root
SET rootPassword=ProvideYourPasswordHereWithoutQuotes
SET MySQLexe=”c:\program files (x86)\labtech\mysql\bin\mysql.exe”
SET sourceFolder=%USERPROFILE%\Desktop\Labtech.1
FOR /f %%a IN (‘dir /b %sourceFolder%\*.sql’) DO “%MySQLexe% –user=%rootuser% –password=%rootPassword% -b labtech < “%sourceFolder%\%%a” Echo. Echo ……………….Imported LabTech data in database……………… Echo ——————— Press any key to Exit———————- pause > nul
Log in to the
Control Center
and verify that all agents are there, and then wait approximately 10 minutes for
the agents to begin to check in