Vues :
Disclaimer:
The installation of MySQL databases is not part of DocuWare support.
As MySQL is a third party application, we have no way of troubleshooting any issues, recommending any additional settings or checking if the installation is fully complete.
DocuWare is not responsible for any corrupted systems if the database is damaged during or after the installation.


Question:
How to upgrade an Internal Database V2 (MySQL 5.6) to an Internal Database V3 (MySQL 8)

Answer:
Updating from MySQL 5.6 to MySQL 8 takes three steps.
You can check your current installed MySQL version by executing
SHOW VARIABLES LIKE "%version%";

All needed files can be found using the following download:
Download-MySQL56TO8

Important notes:
Ensure to shut down all applications accessing the database before any backup/dump attempts.
Make sure to have a valid backup of your database.

Make sure to have a backup of your installation directory.

Do not upgrade DocuWare directly after upgrading MySQL.
Let the system run for some time to check if the complete functionality is still given.


Basic information about MySQL:
During the KBA, the installation directory as well as the data directory will be mentioned.

The installation directory contains all files needed to run the MySQL service, and is located in C:\Program Files (x86)\DocuWare\Internal Database V1\ or C:\Program Files (x86)\DocuWare\Internal Database V2\ depending on previous installations.
If you are unsure where to find your installation directory, please check the MySQL service within Windows Services, you will get the path to the MySQLD.exe file and with it the installation folder.
In this folder, you will find the my.ini and many sub folders, e.g. \bin.
\bin is containing most of the executables and is later on needed to run the upgraders.


The data directory is located in C:\ProgramData\DocuWare\Internal Database\.
Fittingly the folder is named data.

It contains the contents and structure of all database tables for the installed MySQL database.

For the initial part to the upgrade, you only have to work in the installation folder.
During the upgrade to MySQL 8, you need to add a folder on the same level as the data directory.

MySQL 5.6 to MySQL 5.6 final

Stop MySQL service
Extract mysql-5.6.51-winx64.zip

Do not delete, but replace the files within installation folder (Default C:\Program Files (x86)\DocuWare\Internal Database V2)
Start the MySQL Service, either via ServiceControl or Windows Services.

Start a command line with administrative rights and navigate to the installation directory and its subfolder \bin.
(default: C:\Program Files (x86)\DocuWare\Internal Database V2\bin)
Execute the following command.

mysql_upgrade --user=root --password=admin
Choose an administrative MySQL user (e.g. root).
This will upgrade your database tables to the 5.6 final

MySQL 5.6 final to MySQL 5.7

Stop MySQL service
Extract mysql-5.7.38-winx64.zip

Do not delete, but replace the files within installation folder (Default C:\Program Files (x86)\DocuWare\Internal Database V2)

Open the existing my.ini and search for "innodb_additional_mem_pool_size".
Remove the attribute, either by deleting the line or commenting by adding a # at the beginning of the line.

Start the MySQL Service, either via ServiceControl or Windows Services.

As before, use the administrative cmd to run the upgrade command.

mysql_upgrade --user=root --password=admin

This will upgrade your database tables to the 5.7

Mysql 5.7 to MySQL 8
Stop MySQL service

If you want to create a new service using the correct names, delete the current existing MySQL service.
By recreating the service with the new name later, you will see the Internal Database as "Internal Database V3" within the ServiceControl.
Else you can use the old Service using the old "Internal Database V2" name.
sc delete DWMySQL2

Go into the installation folder of MySQL and remove/relocate all current files.
Extract Internal Database V3.zip

If you want to move the location of all MySQL files except data, move extracted files to the new location. Else copy all extracted files into the same path as the old service.
(default: C:\Program Files (x86)\DocuWare\Internal Database V2\)

In addition to the three installation zip files, a my.ini is located in the downloaded zip container.
Copy this my.ini into the folder created in the step above.
Within the my.ini, you have to adjust the following paths:

basedir
datadir
secure-file-priv

As default, basedir is set to C:/Program Files (x86)/DocuWare/, data in C:/ProgramData/DocuWare/ and secure-file-priv is a folder on the same level as the data dir.
You have to manually create the folder "Uploads" in the same subfolder as the datadir.
The path should look something like C:\ProgramData\DocuWare\Internal Database\Uploads\

Make sure that all paths are valid - in doubt, access all paths in the file explorer.

If you deleted the service at the beginning of this step, recreate the service as shown:
Adjust the paths as needed for your environment.
sc create DWMySQL3 binPath= "\"C:\Program Files (x86)\DocuWare\Internal Database V2\bin\mysqld.exe\" --defaults-file=\"C:\Program Files (x86)\DocuWare\Internal Database V2\my.ini\" DWMySQL3" DisplayName= "DocuWare Internal Database V3" start= "auto"
For altered folder paths, please adjust accordingly, but make sure to include the masked characters correctly.

If everything was done correctly, you can start the MySQL service by either using the Service Control, Windows Services or the command
sc start DWMySQL3

Upon start of MySQL 8, the tables will be updated automatically.

If any error occurs during the upgrade, you sadly have to roll back to the last functioning version.
As you most probably did the upgrade of MySQL in rapid succession, we recommend to start from 5.6 Internal Database V2 with the backup.