Pharmacy Management System

Complete MySQL Server Setup, Workbench Configuration, Database Initialization & Software Installation Manual

System Version: 1.0.0

Database Target: MySQL 8.x / 9.x

Recipient: Technical Operations / System Administrator

Date: May 2026

1. System Introduction & Prerequisites

This manual provides exhaustive, step-by-step instructions to set up the Pharmacy Management System (PharmacyMS) and its target database environment. The system utilizes a robust multi-tiered architectural schema built on top of a MySQL Database Server to manage pharmacy operations, secure salaries, transactions, and discount card engines.

💡 System Architecture Highlight

PharmacyMS is fully self-contained. It packages all required .NET runtimes, library dependencies, and security engines. You do not need to install the .NET 8.0 SDK on client computers. You only need to ensure a target MySQL Server is accessible locally or over the network.

Minimum Prerequisites:

2. MySQL Database Server Setup

To run the database locally or on a server, you must install the MySQL Server engine.

Step 1.1

Download and Install MySQL Server

  1. Navigate to the official MySQL downloads site: https://dev.mysql.com/downloads/installer/
  2. Select the MySQL Installer Web Community or full offline installer package.
  3. Run the downloaded MSI installer.
  4. In the installation dashboard, select "Custom" or "Server only". For a full administration setup, choose "Developer Default" (this automatically bundles MySQL Server, MySQL Shell, and MySQL Workbench).
  5. Click "Execute" to download and install all selected packages.
Step 1.2

Server Configuration & Security Setup

  1. Type and Networking: Under "Server Configuration Type", select "Development Computer" if installing locally, or "Server Computer" if installing on a central dedicated machine. Ensure "TCP/IP" is checked and the Port is set to 3306.
  2. Authentication Method: Select "Use Strong Password Encryption for Authentication (RECOMMENDED)".
  3. Accounts and Roles (Root Password):
    • Set a strong password for the root administrative user.
    • Write this password down securely. You will need this root password to configure the database connections, execute the schema, and create users.
  4. Windows Service: Ensure "Configure MySQL Server as a Windows Service" is enabled. Set the Service Name to MySQL80 (or appropriate version) and check "Start the MySQL Server at System Startup".
  5. Click "Execute" to apply the configurations. The service will verify, start, and remain active in the background.

3. Workbench Configuration & Database Schema Initialization

Using MySQL Workbench, we will establish administrative access, initialize the pharmacy database, execute the structural schema, and provision the initial administrator account.

Step 2.1

Creating an Administrative Connection

  1. Launch MySQL Workbench from your Windows Start Menu.
  2. Click the "+" icon next to "MySQL Connections" to add a new connection.
  3. Configure the Connection profile:
    • Connection Name: Localhost Admin
    • Connection Method: Standard (TCP/IP)
    • Hostname: 127.0.0.1 (or database server IP address)
    • Port: 3306
    • Username: root
  4. Click "Store in Vault..." and enter the secure root password defined during server configuration.
  5. Click "Test Connection". Upon receiving a "Successfully made the MySQL connection" banner, click "OK".
Step 2.2

Creating the Database and Schema Execution

You must initialize the database structure before the pharmacy app can begin operations. While the app can auto-generate missing fields, running the verified production schema ensures optimal database constraints.

  1. Open the newly created "Localhost Admin" connection in Workbench.
  2. In the top SQL Query Editor tab, execute the following SQL to create a clean database schema named pharmacy_db:
    CREATE DATABASE IF NOT EXISTS `pharmacy_db` 
    CHARACTER SET utf8mb4 
    COLLATE utf8mb4_unicode_ci;
  3. Now, we will load the complete database tables structure. In the Workbench top menu, go to File > Open SQL Script...
  4. Select the verified script file: Pharmacy_db.sql
  5. Ensure the target database is set by selecting pharmacy_db, or add this directive at the very top of your SQL Editor:
    USE `pharmacy_db`;
  6. Click the **Lightning Bolt icon** ⚡ (or press Ctrl+Shift+Enter) to execute the complete schema. The output console at the bottom will log a succession of successful table creations.
Step 2.3 - CRITICAL

Provisioning the Initial Administrator User

The system validates user logins using a secure SHA-256 Base64 hashing algorithm. To enable the very first login into the application dashboard, you must manually insert one root administrative user. The credential mapping for this initial user is:

Username Desired Password SHA-256 Base64 Hash Value (Stored in DB) Assigned Role
admin admin jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg= Admin

Execute this exact SQL query inside your MySQL Workbench editor to provision this initial account:

INSERT INTO `pharmacy_db`.`users` 
(`username`, `password_hash`, `full_name`, `role`, `salary`, `phone`, `email`, `is_active`)
VALUES 
('admin', 'jGl25bVBBBW96Qi9Te4V37Fnqchz/Eu4qB9vKrRIqRg=', 'Administrator', 'Admin', 0.00, '1234567890', 'admin@pharmacy.com', 1);

💡 Security Note

Once you successfully launch the system, it is highly recommended to navigate to the Employee Directory or Profile Settings inside the UI and change this default password to something stronger. The UI automatically handles the secure SHA-256 normalization and Base64 hashing on save.

4. Creating a Dedicated App Database User

It is a severe security vulnerability to connect your daily desktop application using the administrative root credential. Instead, we will configure a dedicated user in Workbench that is restricted to the specific database.

Step 3.1

Creating User and Granting Localhost & Network Privileges

  1. Inside MySQL Workbench, in the left navigation sidebar under "Administration", click "Users and Privileges".
  2. Click "Add Account" at the bottom of the pane.
  3. On the "Login Limits" tab, configure:
    • Login Name: pharmacy_user
    • Authentication Type: Standard
    • Limit to Hosts Matching: % (This wildcard allows connections from any host on the network. If the server and application are on the same machine, you can set this to localhost or 127.0.0.1 for absolute security).
    • Password / Confirm Password: Choose a strong application password (e.g., PharmSecurePass2026).
  4. Click "Apply" at the bottom-right.
  5. Select the "Schema Privileges" tab at the top.
  6. Click "Add Entry...". Select the radio button "Selected Schema" and choose pharmacy_db from the list. Click "OK".
  7. In the privileges list, click "Select All" to grant standard operational permissions (SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, etc.).
  8. Click "Apply". The dedicated user is now active and isolated to the pharmacy database schema.

5. Software Installation & Setup Wizard

Now that the database environment is fully prepared, you can proceed to install the Pharmacy Management System on the client computer.

Step 4.1

Running the Installer Setup

  1. Locate the compiled installer file: PharmacyMS_Setup.exe
  2. Double-click the installer to launch the modern installation wizard.
  3. Select a custom target directory if desired (Default: C:\Program Files\PharmacyMS).
  4. Check the option to "Create a Desktop Shortcut" to ensure easy access for active cashier terminals.
  5. Click "Install". The installer will unpack the files and compile native binaries.
  6. Once completed, check "Launch Pharmacy Management System" and click "Finish".
Step 4.2

Executing the First-Time Configuration Wizard

Upon the system's very first launch, it will detect that no settings file exists and will automatically open the First-Time Setup Wizard. Fill in the parameters across the three configuration panels:

Panel 1: Database Setup

Panel 2: Pharmacy Profile

Panel 3: SMTP & Admin Configurations

🚀 Ready for Operation

The system will now load the main application login screen. Enter admin as username and admin as password to gain full access to the Pharmacy Management System! Congratulations on a successful installation.