Skip to main content

How To Copy MariaDB From One 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/ADatabase export on the source POS
File transfer from source POS to destinationFile transfer from source POS to destination
N/ADatabase import on destination POS
N/AIndexing 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

  1. Logon to the source POS.

  2. Ensure the Enactor POS application is not running, close it if needed.

  3. Open the Windows "Services" console (e.g. by running "services.msc").

  4. Select the "MySQL" service and stop it.

Windows Services console showing the MySQL service

  1. Close the "Services" console.

  2. Open Windows Explorer and browse to "C:\Program Files".

  3. Identify and open the directory containing the MariaDB installation (it will be called "MariaDB xx.xx" depending on the version installed).

Windows Explorer showing the MariaDB installation directory

  1. 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.

MariaDB Data directory contents

  1. Browse to the directory where the Enactor POS is installed.
note

To find out the exact path, in a command prompt run "echo %ENACTOR_POS%" E.g.: "C:\Enactor\pos"

Command prompt showing the ENACTOR_POS environment variable

  1. Identify the "Indexes" directory

Enactor POS directory showing the Indexes folder

  1. Check that it is not empty.

Contents of the Indexes directory

  1. 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

  1. Logon to the target POS.

  2. Ensure the Enactor POS application is not running, close it if needed.

  3. Open the Windows "Services" console (e.g. by running "services.msc")

  4. Select the "MySQL" service and stop it.

Windows Services console showing the MySQL service

  1. Minimise the "Services" console.

  2. Open Windows Explorer and browse to "C:\Program Files".

  3. Identify and open the directory containing the MariaDB installation (it will be called "MariaDB xx.xx" depending on the version installed).

Windows Explorer showing the MariaDB installation directory

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

MariaDB Data directory to be replaced

  1. Import the "Data" directory exported from the source POS.

  2. 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%"

  3. Delete the "Indexes" directory and all its subdirectories.

  4. Import the "Indexes" directory exported from the source POS.

  5. Close Windows Explorer.

  6. Open the "Services" console.

  7. Start the "MySQL" service (starting the MariaDB database).


Verification

  1. Logon to the target POS.

  2. Open HeidiSQL and connect to the local database.

  3. Check that the tables are present and are populated (by checking that their size is not zero).

HeidiSQL showing populated database tables

  1. 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;
  1. The results should be identical:

HeidiSQL query results comparing table sizes on source and target

  1. This will confirm that that database has been copied correctly.

  2. Close HeidiSQL.

  3. To verify the copy of the indexes, open the Enactor POS application.

  4. Run a search on the target POS; the results should be identical to those on the source POS.

Enactor POS search results verifying index data