Installation Steps

Tutorial: Database Setup on Ubuntu & Windows (MySQL, MongoDB, Cassandra)

Database Setup on Ubuntu & Windows (MySQL, MongoDB, Cassandra)
Linux
Windows

This guide covers installing and running MySQL, MongoDB, and Cassandra on Ubuntu.

1. MySQL on Ubuntu

Install MySQL Server:

sudo apt install mysql-server
sudo systemctl status mysql.service

Secure the root account and create a user:

ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'sthithapragna';
FLUSH PRIVILEGES;
CREATE USER 'msqluser'@'localhost' IDENTIFIED BY 'sthithapragna';

Optional resources:

Load Sakila Database

mysql -u root -h 127.0.0.1 -p < ~/Downloads/sakila-db/sakila-schema.sql
mysql -u root -h 127.0.0.1 -p < ~/Downloads/sakila-db/sakila-data.sql

2. MongoDB on Ubuntu

Download and install MongoDB server package:

wget https://repo.mongodb.org/apt/ubuntu/dists/noble/mongodb-org/8.0/multiverse/binary-amd64/mongodb-org-server_8.0.13_amd64.deb
cd Downloads
sudo dpkg -i mongodb-org-*.deb

Enable and Start Service

sudo systemctl enable mongod
sudo systemctl start mongod
systemctl status mongod

Install Mongo Shell (mongosh)

wget -qO- https://www.mongodb.org/static/pgp/server-8.0.asc | sudo tee /etc/apt/trusted.gpg.d/server-8.0.asc
sudo apt-get install gnupg
echo "deb [ arch=amd64,arm64 ] https://repo.mongodb.org/apt/ubuntu noble/mongodb-org/8.0 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-8.0.list
sudo apt-get update
sudo apt-get install -y mongodb-mongosh
mongosh --version

Reference: MongoDB Shell Documentation

3. Cassandra on Ubuntu

Download and extract Cassandra:

wget https://www.apache.org/dyn/closer.lua/cassandra/5.0.5/apache-cassandra-5.0.5-bin.tar.gz
cd Downloads
tar -xzvf apache-cassandra-5.0.5-bin.tar.gz
mv apache-cassandra-5.0.5-bin ~/cassandra

Update .bashrc

export PATH=$PATH:/home/sthithapragna/cassandra/bin

Start Cassandra

cassandra
# Wait 2–3 minutes
nodetool status

Sample Cassandra Queries

Once inside cqlsh, try:

SHOW VERSION;
DESCRIBE CLUSTER;

-- Create a keyspace
CREATE KEYSPACE testks
WITH replication = {
  'class': 'SimpleStrategy',
  'replication_factor': 1
};

USE testks;

-- Create a table
CREATE TABLE users (
    user_id UUID PRIMARY KEY,
    name TEXT,
    age INT,
    email TEXT
);

-- Insert data
INSERT INTO users (user_id, name, age, email)
VALUES (uuid(), 'Alice', 30, 'alice@example.com');

INSERT INTO users (user_id, name, age, email)
VALUES (uuid(), 'Bob', 25, 'bob@example.com');

-- Query data
SELECT * FROM users;
SELECT name, age FROM users WHERE age > 26 ALLOW FILTERING;

✅ You now have MySQL, MongoDB, and Cassandra running on Ubuntu 🚀

This guide covers installing and running MySQL, MongoDB, and Cassandra on Windows.

1. MySQL on Windows

Verify Installation

mysql -u msqluser -p

2. MongoDB on Windows

  • Download MongoDB Community Edition: MongoDB Downloads
  • Install using the MSI installer and configure MongoDB as a Windows service (recommended).
  • Example user: mnosqluser

Verify Installation

mongosh

3. Cassandra on Windows (via Docker)

Apache Cassandra does not run natively on Windows. Use Docker instead:

docker pull cassandra:latest
docker run --name cassandra -d -p 9042:9042 cassandra

Check Container Status

docker ps

Open Cassandra Shell

docker exec -it cassandra cqlsh

✅ You now have MySQL, MongoDB, and Cassandra running on Windows 🚀

Comments

No comments yet. Be the first!

You must log in to comment.