This document provides the complete database setup process for local development and testing.
Use this guide to:
- Install and verify MySQL.
- Create the project database.
- Import the schema from src/main/resources/schema.sql.
- Configure src/main/java/com/pawsconnect/util/DBConnection.java.
- Validate that the backend can connect successfully.
- MySQL 8+
- Read access to src/main/resources/schema.sql
- Write access to src/main/java/com/pawsconnect/util/DBConnection.java
Connect to MySQL and run:
SELECT VERSION();Expected: a MySQL 8.x version string.
CREATE DATABASE IF NOT EXISTS pawsconnect;
USE pawsconnect;From the repository root, use one of the following options.
USE pawsconnect;
SOURCE src/main/resources/schema.sql;Windows PowerShell:
mysql -u root -p pawsconnect < src/main/resources/schema.sqlLinux/Arch:
mysql -u root -p pawsconnect < src/main/resources/schema.sqlUSE pawsconnect;
SHOW TABLES;Expected tables:
- users
- posts
- marketplace_items
Optional row-count check:
SELECT COUNT(*) FROM users;
SELECT COUNT(*) FROM posts;
SELECT COUNT(*) FROM marketplace_items;Open src/main/java/com/pawsconnect/util/DBConnection.java and set your local values:
private static final String URL = "jdbc:mysql://localhost:3306/pawsconnect?useSSL=false&serverTimezone=UTC";
private static final String USER = "root";
private static final String PASSWORD = "your_mysql_password";Important:
- Repository keeps password blank intentionally.
- Never commit real credentials.
After configuring credentials:
- Build project from repository root:
mvn clean package- Run/deploy the app and open session endpoint:
If DB connectivity is correct, authentication and session operations should work after login.
- Access denied for MySQL user:
- Verify username/password and user permissions.
- Unknown database pawsconnect:
- Re-run database creation commands.
- Table not found:
- Re-import schema file.
- Communications link failure:
- Confirm MySQL service is running and port 3306 is reachable.
- Time zone warnings:
- Keep
serverTimezone=UTCin the JDBC URL.
- Keep