# WEEK 16 IN THE ADVANCED CLASS @ BLOCKFUSE LAB
Gm Gm to you reading my article, my article is all about my week 16 in the advanced class with Blockfuse lab learning Backend **(MySQL)**.
Last week was a amazing for me, we started with the introduction to databases which was MySQL, the only struggle we had was with the installation, but gladly we did it and started writing MySQL, like creating a user, database, granting privileges,
Let me talk about MySQL, it’s written in English language, when I first heard about database while learning JavaScript I thought database will really be a though thing, but unfortunately if you haven’t learnt something and someone who’s doing it and feels weak about it tells you something is hard, we’ll just believe it that it’s hard, but today I tell you it’s not like that, everyone has their different learning curve and again i tell you don’t be scared to learn something new even if someone says it’s hard, still learn it, you might be the king there at that particular field.
### MySQL
MySQL is an open-source relational database management system (RDBMS) that uses Structured Query Language (SQL) to store, manage, and retrieve data efficiently.
It organizes data into tables, where relationships between data are defined using primary keys, foreign keys, and indexes, allowing developers to maintain data integrity, consistency, and optimized performance across applications.
#### Key Developer Features
• Relational structure: Data is stored in related tables (rows & columns).
• ACID compliance: Ensures reliability in transactions (Atomicity, Consistency, Isolation, Durability).
• Scalability: Handles everything from small apps to large-scale systems.
• Cross-platform: Runs on Linux, macOS, and Windows.
• Secure: Supports user privileges, SSL, and password hashing.
• Integrations: Works with backend technologies like Node.js, Python, PHP, Java, etc.
### What actually happens:
Your backend sends SQL queries or uses ORMs (like Prisma or Sequelize) to:
• Create and manage tables
• Store user data
• Fetch results
• Handle authentication
• Perform analytics or reporting
**Common example:**
When a user signs up:
1. Your backend receives the request.
2. It hashes the password and inserts user data into a MySQL table.
3. On login, it queries MySQL to verify credentials.
4. MySQL returns the result to your backend → which responds to the frontend.
When building an app, MySQL usually acts as the persistent data layer.
Here’s how it fits in:
```
Frontend (React / Next.js)
↓
Backend (Node.js / Express)
↓
Database (MySQL)
```
Last week we learnt how to install MySQL and also create database, create users, grant privileges, revoke privileges see databases, see users, see a user grants, drop a user, drop a database. Learning all these was great because I wasn’t hard enough, we wrote it in plain English Language
### How to Install MySQL
On Linux (Ubuntu/Debian) run this command:
```
sudo apt update
sudo apt install mysql-server
```
Now Start MySQL service with this command:
`sudo service mysql start`
To access MySQL shell, run this command:
`mysql -u root -p`
You’ll be asked for you password, when you enter it, the you’re in.
## Commands used for interacting with the database:
| Action | Command |
| -------- | --------
| Create Database | CREATE DATABASE db_name;
|Create User| CREATE USER 'user'@'host' IDENTIFIED BY 'password';
Grant Privileges |GRANT ... ON db_name.* TO 'user'@'host';
Revoke Privileges |REVOKE ... ON db_name.* FROM 'user'@'host';
Show Databases |SHOW DATABASES;
Show Users |SELECT User, Host FROM mysql.user;
Show User Grants |SHOW GRANTS FOR 'user'@'host';
Drop User |DROP USER 'user'@'host';
Drop Database |DROP DATABASE db_name;
Switch to a database |USE myapp_db;
See all tables in the current database |SHOW TABLES;
View structure of a specific table |DESCRIBE users;
Thank you so much for reading, and I hope you do get to learn something from me. If you do have any questions, here is my X handle, @pero4l and also my Linktree: https://linktr.ee/devptb . You can reach out or follow me, I also make YouTube videos.
Thank you.