// The world's most advanced open source database.
MARIADB IS THE FUTURE OF OPEN SOURCE DATABASES.
Created by the original MySQL developers, MariaDB is a drop-in replacement for MySQL with more features, better performance, and true open source governance. It's used by millions of organizations worldwide.
WHY MARIADB?
MariaDB offers superior performance through advanced storage engines, horizontal scaling with MariaDB ColumnStore, and the Galera Cluster for high availability. It's fully open source with no vendor lock-in.
TAKE CONTROL OF YOUR DATA.
Learn to design efficient databases, write optimized queries, implement replication, and master the tools that power the modern web.
12 lessons. Complete MariaDB control.
Learn SQL database fundamentals
BeginnerSet up and configure your database server
BeginnerSELECT, INSERT, UPDATE, DELETE operations
BeginnerCreate tables with proper data types
BeginnerConnect tables with INNER, LEFT, RIGHT joins
IntermediateUse GROUP BY, COUNT, SUM, AVG functions
IntermediateSpeed up queries with proper indexing
IntermediateManage database access and security
IntermediateExport and import data safely.
IntermediateSet up master-slave replication for high availability.
AdvancedWrite reusable database routines.
AdvancedFix performance and connection problems.
AdvancedMariaDB Server is one of the most popular open source relational databases. It's built by the original creators of MySQL, ensuring compatibility while adding innovative features.
MariaDB's plugin architecture allows you to customize functionality with storage engines like InnoDB, Aria, ColumnStore, and more. Whether you need transaction safety, full-text search, or big data analytics, MariaDB has you covered.
The MariaDB Foundation ensures the database remains open source forever. No single company controls its directionβit's community-driven development at its best.
The data layer of the modern web runs on MariaDB. Now you can too.
MariaDB is an open-source relational database management system (RDBMS). It was created by the original developers of MySQL in 2009 after MySQL was acquired by Oracle. MariaDB is designed as a "drop-in replacement" for MySQL, meaning most applications work without modification.
1. MariaDB was created by the original _____ developers.
Hint: Original MySQL team
2. MariaDB is designed as a drop-in _____ for MySQL.
Hint: Compatible replacement
3. MariaDB is governed by the _____ Foundation.
Hint: Non-profit organization
4. The default data directory is _____.
Hint: Under /var/lib
5. MariaDB uses the _____ license.
Hint: Open source license
6. To connect as root, use _____ mariadb.
Hint: Superuser access
7. The MariaDB monitor uses _____ to end commands.
Hint: Semicolon
8. MariaDB has more _____ than MySQL.
Hint: Engine types
Installing MariaDB on Debian-based systems:
Run the security script:
1. On Ubuntu, install with _____ install mariadb-server.
Hint: Package manager
2. To start MariaDB, use _____.
Hint: Systemd
3. To enable on boot, use _____ enable mariadb.
Hint: Systemd
4. The security script is _____.
Hint: Secures the installation
5. The test database should be _____.
Hint: Deleted for security
6. The default data directory is _____.
Hint: Database files
7. To connect locally as root, use _____ mariadb.
Hint: Superuser
8. SELECT _____ shows the MariaDB version.
Hint: Function
SQL (Structured Query Language) is the standard language for interacting with relational databases. MariaDB supports the full SQL standard plus extensions.
1. To create a database, use _____ DATABASE.
Hint: SQL command
2. To add data, use _____.
Hint: INSERT INTO
3. To retrieve data, use _____.
Hint: SELECT * FROM
4. To modify data, use _____.
Hint: UPDATE table
5. To remove data, use _____.
Hint: DELETE FROM
6. The _____ clause filters results.
Hint: Conditional
7. To sort results, use _____ BY.
Hint: ORDER BY
8. To limit results, use _____.
Hint: LIMIT 10
Choosing the right data type is crucial for performance and storage efficiency. MariaDB offers a wide variety of types.
1. For exact money values, use _____.
Hint: Exact precision
2. VARCHAR is for _____ length strings.
Hint: Not fixed
3. TIMESTAMP automatically updates on _____.
Hint: Row changes
4. NOT NULL means the column cannot be _____.
Hint: Must have value
5. AUTO_INCREMENT generates _____ numbers.
Hint: Auto numbers
6. PRIMARY KEY combines NOT NULL and _____.
Hint: No duplicates
7. To add a column, use _____ TABLE.
Hint: ALTER TABLE
8. The default engine is _____.
Hint: Storage engine
Relational databases derive their power from relationships between tables. MariaDB supports several types of table relationships.
Returns only matching rows from both tables:
Returns all rows from left table, matched rows from right:
Returns all rows from right table, matched from left:
1. INNER JOIN returns only _____ rows.
Hint: Both tables
2. LEFT JOIN returns all rows from the _____ table.
Hint: First table
3. A junction table implements _____ relationships.
Hint: Bridge table
4. FOREIGN KEY creates a _____ relationship.
Hint: Referential
5. ON DELETE SET NULL keeps the row but sets key to _____.
Hint: Empty
6. A self-join references the same _____ twice.
Hint: Table name
7. Multiple JOINs can connect _____ tables.
Hint: More than 2
8. Composite primary key on junction table uses both _____.
Hint: Both columns
Aggregate functions perform calculations on sets of rows and return a single result.
Group rows by a column:
Filter groups (WHERE doesn't work on aggregates):
Remove duplicates:
Concatenate values within groups:
Add subtotals and grand total:
1. COUNT counts _____.
Hint: Number of rows
2. AVG calculates the _____.
Hint: Mean value
3. GROUP BY groups rows by a _____.
Hint: Column value
4. _____ filters groups, not rows.
Hint: Like WHERE
5. DISTINCT removes _____.
Hint: Unique values
6. GROUP_CONCAT concatenates values in a _____.
Hint: Grouped rows
7. WITH ROLLUP adds _____ totals.
Hint: Subtotals
8. SUM adds all _____ in a group.
Hint: Column values
Indexes are data structures that speed up data retrieval. Think of them like a book index - they help you find information faster.
Without index: Full table scan (reads every row)
With index: Direct lookup (reads only matching rows)
For WHERE status = 'active' AND created > '2024-01-01':
For WHERE status = 'active' only:
1. Indexes speed up data _____.
Hint: Reading data
2. CREATE _____ creates an index.
Hint: SQL command
3. EXPLAIN shows how a query is _____.
Hint: Query plan
4. type: _____ means index lookup.
Hint: Using index
5. Composite indexes use columns in _____.
Hint: Left to right
6. Too many indexes slow down _____.
Hint: INSERT, UPDATE
7. FULLTEXT index is for _____ search.
Hint: Full-text
8. DROP _____ removes an index.
Hint: SQL command
Proper user management is crucial for database security. Grant only the minimum privileges needed.
1. CREATE _____ creates a new user.
Hint: SQL command
2. GRANT _____ gives privileges.
Hint: Permissions
3. localhost means only _____ connections.
Hint: Same machine
4. To remove privileges, use _____.
Hint: Take away
5. SHOW _____ shows user privileges.
Hint: Permissions
6. REQUIRE _____ forces encrypted connections.
Hint: TLS
7. FLUSH _____ applies privilege changes.
Hint: Reload
8. DROP _____ removes a user.
Hint: Delete user
Regular backups are essential. Test your backups regularly!
Creates SQL statements to recreate the database:
Hot backup tool (requires MariaDB 10.1.7+):
1. _____ creates logical SQL backups.
Hint: Backup tool
2. To restore, use _____ < backup.sql.
Hint: Restore command
3. --single-transaction is for _____ tables.
Hint: Transactional
4. mariabackup is a _____ backup tool.
Hint: Hot backup
5. Binary logs enable point-in-_____ recovery.
Hint: PITR
6. Store backups _____ the server.
Hint: Remote location
7. Test _____ regularly.
Hint: Backup testing
8. Cron is used for _____ backups.
Hint: Scheduled
Replication copies data from one database to another for scalability, high availability, or backup purposes.
1. _____ replication has one master and multiple slaves.
Hint: Traditional
2. Galera provides _____ replication.
Hint: Multi-master
3. Binary logging is required on the _____.
Hint: Primary server
4. CREATE _____ creates replication user.
Hint: Account
5. SHOW _____ STATUS shows replication state.
Hint: On slave
6. Galera uses the _____ storage engine.
Hint: Required
7. wsrep_provider provides _____ cluster support.
Hint: Cluster
8. SET GLOBAL read_only = _____ on slave.
Hint: Read-only
Stored routines are SQL code saved in the database that can be called later. They improve performance and encapsulation.
1. Stored procedures are created with _____ PROCEDURE.
Hint: SQL command
2. Functions must _____ a value.
Hint: Output
3. IN parameters pass _____ to the procedure.
Hint: Input
4. OUT parameters return _____.
Hint: Output
5. DECLARE creates a _____.
Hint: Local variable
6. DELIMITER changes the _____.
Hint: Statement end
7. DROP _____ removes a procedure.
Hint: SQL command
8. Functions can be used in _____ statements.
Hint: SQL
When database issues arise, systematic diagnosis is key.
Too many clients connected:
Check partition or filesystem limits:
Check for long-running transactions:
Check if service is running:
1. Check service status with _____.
Hint: Systemd
2. Too many connections means increase _____ connections.
Hint: Limit
3. EXPLAIN shows query _____.
Hint: How it runs
4. Enable slow query _____.
Hint: Logging
5. KILL stops a running _____.
Hint: Process
6. Repair corrupted tables with _____ table.
Hint: mysqlcheck
7. Check table size in _____ schema.
Hint: Metadata
8. --skip-grant-tables resets the _____.
Hint: Root password