What is a database?
A database is an organized collection of information stored so that
people and applications can find, change, and analyze it. A database
is not just a file. It is managed by database software that applies
rules, controls access, protects data, and answers questions.
What
A structured place where business facts are stored.
Why
To prevent duplicate, inconsistent, and lost information.
Under the hood
MySQL stores records on disk and uses memory, indexes, and an optimizer.
BA scenario
A sales BA queries customers and orders to produce a revenue report.
What does RDBMS mean?
RDBMS means Relational Database Management System.
“Relational” means data is organized into related tables. For example,
a Customers table can be related to an Orders table through a customer ID.
“Management System” means software manages storage, security, queries,
relationships, and data rules for you.
Real-life scenario:
Imagine an online store. Customers, products, orders, and payments are
different business entities. Storing everything in one giant spreadsheet
would create repeated customer names and difficult updates. MySQL stores
each entity separately and connects them reliably.
Why MySQL?
MySQL is a popular open-source relational database system. It understands
SQL, the language used to communicate with relational databases.
It is widely used in websites, reporting systems, data warehouses,
applications, and business intelligence pipelines.
How it works:
Your SQL text is sent to the MySQL server. The server parses the
statement, checks whether you have permission, creates an execution
plan, reads or changes the required data, and returns a result.
BA use:
You may use MySQL to validate whether a dashboard number is correct,
investigate a process failure, or create a dataset for a stakeholder.
Server, Workbench, and command line
The MySQL Server stores data and runs SQL.
MySQL Workbench is a graphical tool that helps you
connect, draw models, and execute queries. The command-line
client is a text-based tool that is useful for automation
and professional troubleshooting.
SQL / Terminal
mysql -u analyst -p -h 127.0.0.1 -P 3306
| Part |
Meaning |
| mysql |
Starts the MySQL command-line client. |
| -u analyst |
Supplies the username named analyst. |
| -p |
Asks MySQL to securely prompt for a password. |
| -h 127.0.0.1 |
Connects to the MySQL server on this computer. |
| -P 3306 |
Uses port 3306, the common MySQL port. |
Connecting to and selecting a database
Connecting to a server identifies you. Selecting a database tells MySQL
which collection of tables you want to work with during the current session.
These are two separate ideas.
SQL
SHOW DATABASES;
CREATE DATABASE IF NOT EXISTS sales_lab;
USE sales_lab;
SELECT DATABASE();
Line-by-line breakdown
| Token |
Explanation |
| SHOW |
A command that asks MySQL to display information. |
| DATABASES |
The information we want to display: available databases. |
| CREATE DATABASE |
Creates a new database container. |
| IF NOT EXISTS |
Prevents an error if the database already exists. |
| sales_lab |
The business-friendly name of the database. |
| USE |
Changes the active database for the current session. |
| DATABASE() |
Returns the database currently selected by the session. |
| ; |
Marks the end of a SQL statement. |
Why the semicolon?
The server may receive many lines through a client. The semicolon
tells the client that one complete statement has finished and can
be sent for execution.
Installation and service commands
MySQL has two important pieces: the server, which stores
and processes data, and the client, such as Workbench or
the terminal, which sends SQL to that server. Install the server first;
Workbench is optional but helpful for a beginner because it shows databases,
tables, and results visually.
Windows
- Install MySQL Community Server using MySQL Installer.
- Choose the Developer Default option if you want Server and Workbench together.
- Keep port
3306, create a root password, and remember it securely.
- Start MySQL Workbench and create a connection to
127.0.0.1.
macOS terminal installation
Terminal
brew install mysql
brew services start mysql
brew services stop mysql
mysql --version
Ubuntu / Debian Linux
Terminal
sudo apt update
sudo apt install mysql-server
sudo systemctl enable --now mysql
sudo systemctl status mysql
| Command | What it does | When a BA needs it |
| mysql --version | Prints the installed client version. | Confirm installation and diagnose version-specific behavior. |
| systemctl status mysql | Shows whether the Linux server is running. | Check why a local connection cannot be made. |
| systemctl start mysql | Starts the server service. | Recover after the service was stopped. |
| systemctl stop mysql | Stops the server service. | Maintenance only; existing connections will fail. |
Beginner check: if Workbench says “Can’t connect to MySQL server,”
check the server service first, then verify host, port, username, and password.
The error does not usually mean your SQL query is wrong.