How To Guide Copying a MariaDB Database from an Enactor POS to Another
Introduction
The purpose of this guide is to show how to copy a MariaDB database (including the Lucene indexes) from an existing Enactor POS to a different one (where the database may be empty) by copying the MariaDB directory containing the data file.
While this procedure may appear unorthodox, it is more efficient than a traditional export, which requires additional steps (e.g. exporting/dumping the source database, importing into the target database) and is much slower with large databases. See the below comparison table:
| Database copy (the procedure in this document) | Database export (the standard procedure) |
|---|---|
| N/A | Database export on the source POS |
| File transfer from source POS to destination | File transfer from source POS to destination |
| N/A | Database import on destination POS |
| N/A | Indexing jobs |
Requirements and Limitations
Requirements:
-
A source computer running a supported Microsoft operating system (e.g. Windows 10): A supported MariaDB database (this procedure is based on version 10.3.27). An Enactor POS version 2.6 or greater.
-
A destination computer running a supported Microsoft operating system: A supported MariaDB database, same version as in the source computer. An Enactor POS, same version as in the source POS.
-
The database username and password must be the same on both computers.
-
A network connection between the two computers or other means to transfer the files.
Limitations:
-
The two computers must be running the same operating system type (e.g. both Windows).
-
The two computers must have had preinstalled the same version of MariaDB; please note, the versions must be identical or this procedure might not work or cause unexpected issues.
-
This procedure is supported by Enactor (within the parameters and limitations described in this document) but is not the documented method to copy databases by MariaDB and will not be supported by MariaDB and other third parties.
Procedure
Copying Files from the Source POS
-
Logon to the source POS.
-
Ensure the Enactor POS application is not running, close it if needed.
-
Open the Windows "Services" console (e.g. by running "services.msc").
-
Select the "MySQL" service and stop it.

-
Close the "Services" console.
-
Open Windows Explorer and browse to "C:\Program Files".
-
Identify and open the directory containing the MariaDB installation (it will be called "MariaDB xx.xx" depending on the version installed).

- Inside the MariaDB directory, take a copy of the entire "Data" directory; this can be copied to a staging location or directly to the target POS.

- Browse to the directory where the Enactor POS is installed.
To find out the exact path, in a command prompt run "echo %ENACTOR_POS%"
E.g.: "C:\Enactor\pos"
- Identify the "Indexes" directory

- Check that it is not empty.

- Take a copy of the entire directory; similarly to the MariaDB "Data" directory, this can be copied to a staging location or directly to the target POS.
Loading the Database on the Target POS
-
Logon to the target POS.
-
Ensure the Enactor POS application is not running, close it if needed.
-
Open the Windows "Services" console (e.g. by running "services.msc")
-
Select the "MySQL" service and stop it.

-
Minimise the "Services" console.
-
Open Windows Explorer and browse to "C:\Program Files".
-
Identify and open the directory containing the MariaDB installation (it will be called "MariaDB xx.xx" depending on the version installed).

- If it exists, delete the "Data" directory and its sub-directories.

-
Import the "Data" directory exported from the source POS.
-
Browse to the directory where the Enactor POS is installed (should be the same path as in the source POS). To find out the exact path, in a command prompt run "echo %ENACTOR_POS%"
-
Delete the "Indexes" directory and all its subdirectories.
-
Import the "Indexes" directory exported from the source POS.
-
Close Windows Explorer.
-
Open the "Services" console.
-
Start the "MySQL" service (starting the MariaDB database).
Verification
-
Logon to the target POS.
-
Open HeidiSQL and connect to the local database.
-
Check that the tables are present and are populated (by checking that their size is not zero).

- The following query can be run on both the source and the target POS:
SELECT
TABLE_NAME AS `Table`,
ROUND((DATA_LENGTH + INDEX_LENGTH) / 1024 / 1024) AS `Size (MB)`
FROM
information_schema.TABLES
WHERE
TABLE_SCHEMA = "enactorpos"
ORDER BY
(DATA_LENGTH + INDEX_LENGTH)
DESC;
- The results should be identical:

-
This will confirm that that database has been copied correctly.
-
Close HeidiSQL.
-
To verify the copy of the indexes, open the Enactor POS application.
-
Run a search on the target POS; the results should be identical to those on the source POS.
