Q&A 1 How do you install and run MySQL locally using XAMPP?
1.1 Explanation
XAMPP is a free, open-source web server stack that bundles Apache, MySQL (MariaDB), PHP, and Perl. It lets you set up a local environment in minutes β no complex server setup required.
For beginners and researchers, this is an easy way to learn SQL and test databases locally before deploying to cloud platforms.
π Note: XAMPP uses MariaDB, a drop-in replacement for MySQL. It behaves almost the same as MySQL, with extra features and performance improvements.
1.2 Prerequisites
- Download and install XAMPP: https://www.apachefriends.org
- Open the XAMPP Control Panel
- Start these services:
- MySQL Database (required)
- Apache Web Server (optional, for phpMyAdmin and web apps)
- MySQL Database (required)
1.3 π Accessing MySQL/MariaDB in XAMPP (macOS)
Once MySQL is running, you have two ways to work with it:
1.3.1 π Option 1: phpMyAdmin (GUI)
- Open your browser and visit:
http://localhost/phpmyadmin
This web interface is convenient for:
- Creating and dropping databases
- Running SQL queries with a query editor
- Browsing and editing data visually
1.3.2 π» Option 2: MySQL/MariaDB Command Line (CLI)
If you prefer terminal commands, open your macOS terminal:
# Step into the XAMPP MySQL directory (where the MariaDB binary lives)
cd /Applications/XAMPP/bin
# (Optional, first-time only) Make the mysql binary executable
chmod +x mysql
# Launch the MariaDB shell as the root user
# Note: By default in XAMPP, the root user has no password
./mysql -u rootWhen it works, you should see a welcome screen like this:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 324
Server version: 10.4.28-MariaDB Source distribution
Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
MariaDB [(none)]>
This prompt means youβre inside the MySQL/MariaDB shell and can run SQL commands directly.
βΈ»