This guide explains how to set up MariaDB, create a database, and Create Database User.
Installing MariaDB on Ubuntu:
apt update && apt install mariadb-server -yOpen the Command Prompt as Administrator and run the following command to secure your installation:
mysql_secure_installationOpen terminal and login to MariaDB:
mysql -u root -pEnter the root password when prompted.
Create a new database and user:
CREATE DATABASE bakery_db;
CREATE USER 'admin'@'localhost' IDENTIFIED BY 'ganeshjadhav';
GRANT ALL PRIVILEGES ON bakery_db.* TO 'admin'@'localhost';
FLUSH PRIVILEGES;- DB_HOST:
localhost(or AWS RDS Endpoint) - DB_USER:
admin - DB_PASS:
ganeshjadhav - DB_NAME:
bakery_db
- Build EC2: Launch an Ubuntu 22.04 instance.
- Build RDS: Create a MySQL/MariaDB database (Choose defaults/Free Tier).
- Security Groups:
- Allow Port 80 (HTTP) and 8082 (Backend) for EC2.
- Allow Port 3306 (MySQL) for RDS from EC2 Security Group.
- SSH into your EC2.
- Update the system:
sudo apt update && sudo apt upgrade -y - Install MySQL Client:
sudo apt install mysql-client -y
- Connect to RDS:
mysql -h <rds-endpoint> -u <username> -p # Press Enter, then type your password
- Create Database:
CREATE DATABASE bakery_db; EXIT;
- Install Docker & Docker Compose:
sudo apt install docker.io docker-compose -y sudo systemctl start docker sudo systemctl enable docker - Update Files with Public IP:
- In main.js, change the IP to your EC2 Public IP.
- This is necessary for Admin login, Emp login, and Contact forms to work.
- Build and Run:
docker-compose up --build -d
- Check Logs:
docker-compose logs -f
- Access the app: Paste your EC2 Public IP in Chrome browser.