We recommended to use MySql Workbench tool to backup and restore your database as shown in the link: [BioStar 2] Database Backup and Restore Instructions .

However if your Maria DB service cannot start because of some issue such as database corruption, you can use the procedure shown below to back up your database.


Scripted Option

You can use a batch script to run the process with minimal input.

Download the file from the link below:


BioStar 2.4.1 script: http://webhard.suprema.co.kr//ExFd/14929/24391.zip

BioStar 2.5 script: http://webhard.suprema.co.kr//ExFd/16195/11711.zip


Note:

    1. You must run this script on your PC with BioStar 2 Server with administrator privileges.

    2. It is recommended to stop your BioStar 2 services before running backup or restore.

       - The script provides a sequence to stop and start all services

    3. This will not work on BioStar 2 versions lower than BioStar 2.4 because of the different database structure.


Run the file and choose your operation.


Manual Option


Backing up the AC Database

1. Stop BioStar 2 services in BioStar Setting.


2. Run a command prompt with administrator privileges.


3. Type the command below to access your database directory and press enter:

    - For 32bit:
        cd C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    - For 64bit:
        cd C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



4. Type the command below to back up your database and press enter:


 mysqldump -u %UserID% --password=%UserPW% -P 3312 --routines --triggers --max_allowed_packet=1G --hex-blob --default-character-set=utf8 biostar2_ac  > ACbackup.sql


** enter your database administrator ID in %UserID%. If you did an express installation, your ID is ‘root’

** enter your ID password in %UserPW%



5. If the command ran successfully, you should have a ACbackup.sql in your directory below:

For 32bit:

    C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

For 64bit:

    C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin


** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.




6. Start BioStar 2 services again in BioStar Setting if you are done with your back up process.



Backing up the T&A Database


1. Stop BioStar 2 services in BioStar Setting.


2. Run a command prompt with administrator privileges.



3. Type the command below to access your database directory and press enter:

    For 32bit:
        cd C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:
        cd C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



4. Type the command below to back up your database and press enter:

 mysqldump -u %UserID% --password=%UserPW% -P 3312 --routines --triggers --max_allowed_packet=1G --hex-blob --default-character-set=utf8 biostar_tna  > TAbackup.sql


** enter your database administrator ID in %UserID%. If you did an express installation, your ID is ‘root’

** enter your ID password in %UserPW%



5. If the command ran successfully, you should have a TAbackup.sql in your directory below:

    For 32bit:

        C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:

        C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin
** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



6. Start BioStar 2 services again in BioStar Setting if you are done with your back up process.


Backing up the Video Database (BioStar 2.5 64bit and above only) 

1. Stop BioStar 2 services in BioStar Setting.


2. Run a command prompt with administrator privileges.



3. Type the command below to access your database directory and press enter:

    For 32bit:
        cd C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:
        cd C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



4. Type the command below to back up your database and press enter:

mysqldump -u %UserID% --password=%UserPW% -P 3312 --routines --triggers --max_allowed_packet=1G --hex-blob --default-character-set=utf8 biostar_ve  > Videobackup.sql


** enter your database administrator ID in %UserID%. If you did an express installation, your ID is ‘root’

** enter your ID password in %UserPW%


5. If the command ran successfully, you should have a Videobackup.sql in your directory below:

    For 32bit:

        C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:

        C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin
** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.


6. Copy the files in the db and records folder of C:\Program Files\BioStar 2(x64)\ve and back it up in another safe directory. 


7. Start BioStar 2 services again in BioStar Setting if you are done with your back up process.


Restoring the AC Database

1. Stop BioStar 2 services in BioStar Setting


2. Run a command prompt with administrator privileges.


3. Type the command below to access your database directory and press enter:

    For 32bit:
        cd C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:
        cd C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



4. Your ACbackup.sql should be in the folder below. If not, please paste the file into this folder:

    For 32bit:

        C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:

        C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.

5. Type the command below to restore your database and press enter:


mysql.exe -h 127.0.0.1 -P 3312 -u %UserID% --password=%UserPW% biostar2_ac --max_allowed_packet=1G --default-character-set=utf8 < ACbackup.sql

** enter your database administrator ID in %UserID%. If you did an express installation, your ID is ‘root’
** enter your ID password in %UserPW%

6. Type the command below to add privilege to your database administrator account:

mysql.exe -h 127.0.0.1 -P 3312 -u %UserID% --password=%UserPW% -e "grant all privileges on biostar2_ac.* to %UserID%@localhost; flush privileges;"
** enter your ID and password

7. After the process finishes, start BioStar 2 services again in BioStar Setting and check that the database was restored properly.


Restoring the T&A Database

1. Stop BioStar 2 services in BioStar Setting.


2. Run a command prompt with administrator privileges.


3. Type the command below to access your database directory and press enter:

    For 32bit:
        cd C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:
        cd C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



4. Your TAbackup.sql should be in the folder below. If not, please paste the file into this folder:

    For 32bit:

        C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:

        C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.

5. Type the command below to restore your database and press enter:


mysql.exe -h 127.0.0.1 -P 3312 -u %UserID% --password=%UserPW% biostar_tna --max_allowed_packet=1G --default-character-set=utf8 < TAbackup.sql


** enter your database administrator ID in %UserID%. If you did an express installation, your ID is ‘root’
** enter your ID password in %UserPW%

6. Run the query below to provide administrator privileges to your database admin account:


mysql.exe -h 127.0.0.1 -P 3312 -u %UserID% --password=%UserPW% -e "grant all privileges on biostar2_ac.* to %UserID%@localhost; flush privileges;"


** enter your ID and password

7. Run a query to set 4 fields as null in the SystemSetting table by entering the command below:


mysql -h 127.0.0.1 -P 3312 --user=%UserID% --password=%UserPW% biostar_tna -e "UPDATE biostar_tna.systemsetting SET ext_system_session_id= null, ext_system_id= null, ext_sys_biostar_session_id = null, ext_sys_session_udt_datetime = null WHERE id=1;"


** enter your ID and password

8. If user synchronization is necessary, type the command below to run the query:


mysql -h 127.0.0.1 -P 3312 --user=%UserID% --password=%UserPW% biostar_tna -e "UPDATE biostar_tna.systemsetting SET last_udt_ver_for_user_sync = null WHERE id=1;"


** enter your ID and password

9. After the process finishes, start BioStar 2 services again in BioStar Setting and check that the database was restored properly.



Restoring the Video Database

1. Stop BioStar 2 services in BioStar Setting


2. Run a command prompt with administrator privileges.


3. Type the command below to access your database directory and press enter:

    For 32bit:
        cd C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:
        cd C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.



4. Your ACbackup.sql should be in the folder below. If not, please paste the file into this folder:

    For 32bit:

        C:\Program Files (x86)\BioStar 2\ta\mariadb-10.1.10-win32\bin

    For 64bit:

        C:\Program Files\BioStar 2(x64)\ta\mariadb-10.1.10-winx64\bin

 ** If your BioStar 2 is installed in a different Drive other than the default C drive, change the ‘C:’ portion of the command to your desired drive letter.

5. Type the command below to restore your database and press enter:


mysql.exe -h 127.0.0.1 -P 3312 -u %UserID% --password=%UserPW% biostar_ve --max_allowed_packet=1G --default-character-set=utf8 < Videobackup.sql

** enter your database administrator ID in %UserID%. If you did an express installation, your ID is ‘root’
** enter your ID password in %UserPW%

6. Type the command below to add privilege to your database administrator account:

mysql.exe -h 127.0.0.1 -P 3312 -u %UserID% --password=%UserPW% -e "grant all privileges on biostar_ve.* to %UserID%@localhost; flush privileges;"
** enter your ID and password


7. Paste the backed up db and records folder in C:\Program Files\BioStar 2(x64)\ve. If you don't have a records folder, create one. 


8. After the process finishes, start BioStar 2 services again in BioStar Setting and check that the database was restored properly.