Chapter 01 · MariaDB Foundations, Release Model, Editions, and Lab Setup

Install MariaDB on Windows, Linux, Containers, and Verify Client/Server Tooling

Install and verify MariaDB on Windows, Linux, or containers, proving server/client identity, service state, endpoints, data directory, and logs instead of stopping at package installation.

Intermediate90–120 minutesWindows/Linux/container install labMariaDB Community 12.3.2Docker path is reproducible baselineLast reviewed: August 2026

Learning outcomes

A package manager can report “installation successful” while the database service is stopped, listening on a different endpoint, initialized with unexpected authentication, or paired with an older client executable. ServiceHub therefore needs an installation procedure whose acceptance criterion is not “files exist” but “a known client can reach the intended server and prove its identity.”

This lesson shows current installation patterns for Windows, mainstream Linux packaging, and containers. Commands can change as repositories and operating systems evolve, so the official MariaDB installation pages remain the authority. The reproducible path uses a disposable Community Server 12.3.2 container because it is platform-neutral and easy to remove; native Windows/Linux paths are taught and verified but need platform-specific administrative privileges.

01

Distinguish server installation, data-directory initialization, service startup, client installation, and successful connection.

02

Verify mariadbd, mariadb, and mariadb-admin versions independently.

03

Identify the effective server data directory, TCP port/socket, service state, and error-log evidence.

04

Install or run MariaDB safely on Windows, Linux, or a container without assuming Bash-only workflows.

05

Diagnose the common client-version-versus-server-version mistake and establish a reproducible disposable lab.

Baseline

Examples pin mariadb:12.3.2 because that is the latest stable LTS at review time. Re-check the official release page before running this lesson in the future. Never use an RC/preview tag merely because it has a larger version number.

1. Installation has five separate acceptance gates

Treat installation as a chain: obtain the intended package → initialize or mount a data directory → start mariadbd → connect with a client → verify the server identity and effective configuration. A failure at any gate should stop the procedure. This avoids the common state where an administrator installs a new client but continues talking to an old server already listening on port 3306.

Gate Evidence What it prevents
Package/binary Package manager or image digest/tag; mariadbd --version Wrong build/package
Initialization System tables/data directory created; startup log Uninitialized or wrong datadir
Service/process Service manager, container state, error log Installed but stopped server
Connectivity mariadb-admin ping / successful SQL session Wrong port/socket/firewall/auth
Identity SQL VERSION(), @@datadir, @@port, @@socket Talking to a different server

2. Windows: MSI installation and service verification

On Windows, MariaDB provides MSI installers. The installer can install server/client components and configure a Windows service. Exact screens and service names can vary by version and choices, so record the service name during installation rather than assuming it.

powershell · PowerShell — discover and inspect MariaDB services
Get-Service | Where-Object {  $_.Name -match 'MariaDB|MySQL' -or $_.DisplayName -match 'MariaDB'}# Replace <ServiceName> with the exact service discovered above.Get-Service -Name <ServiceName># Verify executables if they are on PATH.mariadbd --versionmariadb --versionmariadb-admin --version

If the executable is not on PATH, use the full installation path rather than copying a path from another machine. The service can be running even when your shell resolves an older client from a different installation, which is why client and server identity must be checked separately.

Windows data safety

Do not point a new server binary at an existing production data directory as an installation test. Use the installer’s intended data directory or a disposable instance. Release-series upgrades require the upgrade workflow taught later in the course.

3. Linux: package repositories, service manager, and socket reality

On Debian/Ubuntu and Red Hat-family systems, MariaDB can be installed through package managers. Distribution repositories can ship a different series from MariaDB’s own repository, so first decide which source you intend to use. Package provenance is part of your production baseline.

bash · Debian/Ubuntu pattern — verify repository documentation before use
sudo apt updatesudo apt install mariadb-server mariadb-clientsudo systemctl status mariadb --no-pagermariadbd --versionmariadb --versionmariadb-admin --version
bash · RHEL/Fedora-family pattern — package names/repositories can vary
sudo dnf install MariaDB-server MariaDB-clientsudo systemctl enable --now mariadbsudo systemctl status mariadb --no-pagermariadbd --versionmariadb --versionmariadb-admin --version

Use the exact current MariaDB repository setup documentation if you need a particular series. Do not blindly run the examples on a production host. Unix socket locations differ by distribution; the mariadb client documentation lists common paths, but your server’s @@socket value is the final evidence for the connected instance.

4. Containers: the reproducible Chapter 01 path

A container provides a disposable learning instance without changing host package repositories. It does not remove database responsibilities: you still need explicit image versioning, credentials, port mapping, storage decisions, health verification, logs, and cleanup. For Chapter 01 we deliberately use ephemeral storage so destructive experiments cannot touch a real database.

text · PowerShell or shell — start a disposable MariaDB 12.3.2 container
docker pull mariadb:12.3.2docker run --name bda-mariadb-01   -e MARIADB_ROOT_PASSWORD=lab-only-change-this   -p 3307:3306   -d mariadb:12.3.2docker ps --filter name=bda-mariadb-01docker logs --tail 80 bda-mariadb-01

The password above is intentionally labeled a disposable local-lab secret. Do not reuse it, do not place real credentials in source control, and prefer secret injection appropriate to your platform for non-lab environments. Port 3307 on the host avoids colliding with a native server already using 3306.

text · verify health from inside the container
docker exec bda-mariadb-01 mariadb-admin   --user=root --password=lab-only-change-this pingdocker exec -it bda-mariadb-01 mariadb   --user=root --password=lab-only-change-this

A healthy mariadb-admin ping commonly reports that the server is alive. That proves the server responded to the administrative client; it does not prove schema correctness, backup readiness, or production security.

5. Prove server identity from SQL

sql · server-side identity and effective endpoints
SELECT VERSION() AS server_version,       @@version_comment AS version_comment,       @@hostname AS hostname,       @@port AS port,       @@socket AS socket,       @@datadir AS data_directory,       @@default_storage_engine AS default_engine,       @@character_set_server AS server_charset,       @@collation_server AS server_collation,       @@sql_mode AS global_effective_sql_mode;

Compare this SQL result with mariadb --version. The command-line value identifies the client executable on the machine where you invoked it. VERSION() identifies the server that accepted your connection. They can differ during upgrades, when multiple packages are installed, or when a remote server is used.

Do not infer configuration from files yet

The server’s option files and precedence are covered in Chapter 03. For now, prefer effective SQL variables and startup logs. Finding a value in my.cnf does not prove that the running server read that file or that a later option source did not override it.

6. Deliberately wrong: verify only mariadb --version

Suppose you install MariaDB 12.3 client binaries and run mariadb --version. The output says 12.3, so you write “server upgraded successfully” in the change ticket. In reality, the client may have connected to an older local service, a remote host, or a container on another port. The command never contacted the server.

Repair the workflow by pairing client evidence with a connection and server query. Also verify the endpoint: host, port/socket, hostname, and data directory. If multiple local instances exist, make the connection parameters explicit rather than relying on defaults.

text · explicit TCP verification against the container
mariadb --protocol=tcp --host=127.0.0.1 --port=3307   --user=root --password-- Then inside the SQL client:SELECT VERSION(), @@hostname, @@port, @@datadir;

7. Initialization and post-install hardening are separate from package installation

Native packages often initialize the data directory and integrate a system service for you, while manual or custom deployments may require mariadb-install-db before mariadbd can start. Treat initialization as a one-time creation of the server’s system tables and data-directory structure—not as a command to rerun casually against an existing production directory. Record the actual data directory first and use a disposable location for experiments.

MariaDB also provides mariadb-secure-installation as an interactive hardening helper. Its historical reputation as “the command that sets the root password” can be misleading on modern MariaDB installations because Unix-socket authentication is commonly used for the local administrative account. The script can still help remove anonymous users, remote root access, and test databases depending on the installation, but you should understand each proposed change and verify the resulting accounts/plugins rather than treating the script as an opaque security certificate.

sql · verify authentication and initialization state before changing it
SELECT User, Host, pluginFROM mysql.userORDER BY User, Host;SELECT @@datadir AS data_directory,       @@socket AS socket_path,       @@port AS tcp_port;SHOW DATABASES;

The lesson does not require you to modify administrative authentication. For the course lab, the root/admin identity is only used to create dedicated low-privilege accounts in Lesson 5. Production authentication, TLS, plugin choice, remote administration, and secret rotation receive a dedicated treatment later in the course.

8. Hands-on lab: install, verify, break safely, recover

Use the container path unless you already have a disposable native installation. First start and verify the server. Then deliberately attempt a connection to the wrong host port 3308. You should receive a connection failure. Diagnose it by checking the published port mapping with docker ps and retry on 3307. This failure teaches endpoint verification without damaging data.

text · intentional connection failure then correction
# Expected to fail because this lab did not publish host port 3308.mariadb --protocol=tcp --host=127.0.0.1 --port=3308   --user=root --password# Correct endpoint.mariadb --protocol=tcp --host=127.0.0.1 --port=3307   --user=root --password

Verification checklist

  • mariadbd --version, mariadb --version, and SQL VERSION() are recorded separately.
  • The server reports the expected data directory and endpoint.
  • mariadb-admin ping succeeds on the intended instance.
  • The error log/container log shows normal startup rather than ignored fatal errors.
  • You can explain why host port 3307 maps to container port 3306.
text · cleanup the disposable container when you are done
docker stop bda-mariadb-01docker rm bda-mariadb-01

9. Production judgment: reproducibility beats “works on my machine”

For production, pin an approved release series and package/image provenance, but also maintain a patching process so “pinning” does not become permanent vulnerability exposure. Record service names, option-file locations, data directories, ports/sockets, log locations, authentication assumptions, and package sources. Installation automation should verify a live connection and server identity before declaring success.

Containers make labs convenient, but production durability requires persistent volumes, backup/recovery, secrets, resource controls, monitoring, image update policy, and topology design. Native packages simplify service integration but create their own repository and upgrade responsibilities. The next lesson uses whichever verified local server you chose to build a reusable ServiceHub database with explicit accounts, InnoDB, SQL mode, character set, and reset conventions.

Check your understanding

  1. Why is “package installed successfully” not the same as “MariaDB is usable”?
  2. What does mariadb --version identify, and what identifies the connected server version?
  3. Why should a Linux operator record package-repository provenance?
  4. What does host port 3307:3306 mean in the Docker example?
  5. Why should you query @@datadir and @@socket instead of assuming distro defaults?
Review the answers

Installation is complete only after initialization, startup, connectivity and identity checks. mariadb --version reports the client executable; SQL VERSION() reports the connected server. Repository provenance determines which series and maintenance stream you actually receive. Docker mapping 3307:3306 exposes container port 3306 as host port 3307. Data-directory and socket defaults vary by package/platform, so the running server’s effective values are stronger evidence than a tutorial.

Authoritative references

Keep knowledge open

Help the academy stay free and grow.

If these tutorials save you time, a small donation supports new lessons, technical review, diagrams, examples, and long-term maintenance.

ETHEthereum / ERC-20 only
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0

Send only assets compatible with the Ethereum/ERC-20 network. Do not send TRC-20/TRON assets.