What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To get started with MariaDB, install MariaDB Server for your operating system, connect to it with the mariadb command-line client, then create a database and table and practice basic SQL. This walkthrough takes you through that first local workflow; installation details vary by operating system and package source.

Choose an installation path

MariaDB Server is the database service; the mariadb client is the program you use to connect and run SQL. Install the server on the machine where you want the database to run. For current platform-specific instructions, use the official MariaDB Server installation guide.

Operating system Typical installation route What to do after installation
Linux Install the server and client packages using your distribution’s package manager. Package names and repository setup vary. Run mariadb-secure-installation if provided, then check that the MariaDB service is running; start it using your distribution’s service tools if needed.
Windows Use the MariaDB MSI installer and follow its setup steps. Confirm the server installation and configured account details, then connect with the client.

The exact setup depends on the operating system and the installation options you select. Follow the official guide for the current instructions that match your platform. If you only need a local development database, you do not need to configure remote access.

Connect to MariaDB

Open a terminal or command prompt and run the client. For a local server, an explicit connection looks like this:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
mariadb -u root -p -h localhost
  • -u root selects the MariaDB account named root. Use a different account name if that is what you created or were instructed to use.
  • -p makes the client prompt for the account password. Type it when prompted; it will not be displayed as you enter it.
  • -h localhost specifies the server host. If you omit the host, the client usually connects to localhost.

Use a password prompt rather than putting the password in the command itself: a password in a command line can be exposed through process listings or command history. A default host does not guarantee that authentication will succeed; available accounts and authentication settings depend on how MariaDB was installed and configured. See the MariaDB connection guide for client options and connection behavior.

When the connection succeeds, the client accepts SQL statements. End ordinary statements with a semicolon; you can also write a statement across multiple lines before terminating it.

Create and select a practice database

At the MariaDB prompt, create a database named bookstore and select it:

CREATE DATABASE bookstore;
USE bookstore;

The account needs the CREATE privilege to create a database. If you want the command to avoid an error when that database already exists, use CREATE DATABASE IF NOT EXISTS bookstore;; MariaDB issues a warning when it finds the existing database rather than creating another one. The CREATE DATABASE reference explains the syntax and privileges.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Create a table and practice SQL

Create a small table for books. This example uses an auto-incrementing integer primary key, text for the title, and a decimal value for the price:

CREATE TABLE books (
  id INT NOT NULL AUTO_INCREMENT,
  title VARCHAR(200) NOT NULL,
  price DECIMAL(8,2),
  PRIMARY KEY (id)
);

Add a row and query the table:

INSERT INTO books (title, price)
VALUES ('The Left Hand of Darkness', 14.99);

SELECT id, title, price
FROM books;

Use a WHERE clause to target a particular row when changing or removing data. For example, update the price of the row whose ID is 1:

UPDATE books
SET price = 15.99
WHERE id = 1;

A targeted delete removes only the row matching its condition:

DELETE FROM books
WHERE id = 1;

Without a restrictive WHERE clause, an UPDATE or DELETE can affect every row in the table. Inspect your database and table with these commands:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
SHOW TABLES;
DESCRIBE books;

For more examples of connecting, creating tables, and using basic data operations, see the MariaDB Basics Guide.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Keep the server local unless you need remote access

Remote connections are a separate configuration task, not a required step for this tutorial. MariaDB typically does not allow remote logins by default. If you need a client on another machine to connect, configure the server, account permissions, and firewall deliberately, following the connection guide and platform-specific installation instructions. Do not expose a database server publicly just to complete a local practice exercise.

Remove practice data only when you mean to

DROP TABLE removes a table, while DROP DATABASE removes the database and its tables. These are destructive operations, so do not run them as routine setup commands. If you intentionally want to delete this exercise database, verify the name first, then run:

DROP DATABASE bookstore;

MariaDB’s Basic SQL Statements Guide includes a sample SQL sequence that ends by dropping its practice database.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Continue learning

The MariaDB Quickstart Guides cover next steps such as troubleshooting, indexes, joins, and backups. The broader MariaDB Documentation is the reference point for server features and administration.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.