Aral Code

Getting Started Lesson 2 of 13

Installing MySQL — XAMPP, phpMyAdmin and the Command Line

Run MySQL with XAMPP, manage databases in phpMyAdmin, connect with the mysql command-line client, and know about MySQL Workbench.

The easiest way to get MySQL on a Windows or Mac computer, especially for school projects, is XAMPP. It installs MySQL (MariaDB), Apache and PHP together.

Start MySQL with XAMPP

  1. Install XAMPP from apachefriends.org (see the PHP course for details).
  2. Open the XAMPP Control Panel and click Start next to MySQL (and Apache, for phpMyAdmin).
  3. When it turns green, MySQL is running on port 3306.

phpMyAdmin

Open http://localhost/phpmyadmin in your browser. phpMyAdmin is a web interface for MySQL:

  • The left panel lists databases and tables.
  • New creates a database.
  • The SQL tab runs any SQL you type.
  • Import and Export load and save .sql files.
  • Structure shows columns and keys; Browse shows rows.

The mysql command-line client

Every MySQL installation includes a text client. In XAMPP, open the Shell button in the control panel (or C:\xampp\mysql\bin):

mysql -u root -p

Press Enter at the password prompt (XAMPP's root password is empty by default). You'll see the prompt:

Output

Welcome to the MariaDB monitor.  Commands end with ; or \g.
MariaDB [(none)]>

Now type SQL commands, ending each with a semicolon:

SHOW DATABASES;

Output

+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
| test               |
+--------------------+
5 rows in set (0.001 sec)

Type exit to leave.

Running a .sql file

Save your table definitions in a file such as school.sql and run it all at once:

mysql -u root -p < school.sql

In phpMyAdmin, the same is done with Import.

Other tools

  • MySQL Workbench: Oracle's free desktop app with a visual table designer and diagrams (ER diagrams).
  • HeidiSQL (Windows) and DBeaver: popular free database clients.
  • VS Code extensions that connect to MySQL.

Installing MySQL without XAMPP

For a standalone server, download MySQL Community Server from mysql.com (the installer can also add Workbench), or use Homebrew on a Mac (brew install mysql). During setup, you'll choose a root password. Remember it.

Quick Quiz

Check what you learned. Walang grade ito, practice lang. 🙂

1. What is the default MySQL port?
2. Where is phpMyAdmin in XAMPP?
3. Which command opens the MySQL client as root?
4. How do you run a whole .sql file in phpMyAdmin?

By Sir Reyel · Last updated 2026-12-04