MariaDB protocol
MariaDB documentation
MySQL vs MariaDB protocols
database protocols
MariaDB guide

Where I can find MariaDB protocol document that different from MySQL

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

Understanding MariaDB and MySQL Protocols

MariaDB and MySQL are both popular open-source relational database management systems (RDBMS) which share a common origin. They both stemmed from the structured query language (SQL) ideal of building robust database management systems. However, over time, both have diverged in their development, with certain features and functionalities distinct between the two. For developers or database administrators who intend to interact with MariaDB on a protocol level, understanding these differences can be crucial.

Protocol Overview

The core of any database interaction is the communication protocol it uses. Both MariaDB and MySQL initially shared the same protocol, but changes have been introduced in MariaDB that differentiate its protocol from MySQL's over time. The protocol of a database determines how data should be formatted and communicated between a client and the database server.

Finding the MariaDB Protocol Documentation

Official documentation for the MariaDB protocol can be acquired from the following resources:

  1. MariaDB Knowledge Base: This is the primary source of documentation and includes detailed explanations on MariaDB protocols.
  2. MariaDB Server Source Code: The protocol specifications can also be gleaned directly from the MariaDB source code distributions, which contain comments and documentation in the code that may provide further nuances.
  3. MySQL to MariaDB Migration Guide: This guide helps you understand distinctive features if switching from a MySQL viewpoint.

Key Differences in Protocol

While the core protocol for both MariaDB and MySQL is similar, MariaDB introduces a few differences that users should be aware of when comparing it to MySQL:

FeatureMariaDB ProtocolMySQL Protocol
Default AuthenticationUses mysql_native_password but started integratinged25519Typically uses caching_sha2_password
JSON Data TypeMariaDB uses JSON as a datatype but also extends its functionalityJSON datatype is supported
Encryption CapabilitiesOffers table and tablespace level encryptionSupports only table level encryption
Compatibility with MySQLBackward compatible with MySQL, but not forwardCompatible with earlier versions only
Protocol ExtensionsMariaDB has unique commands and extensions like CONNECT, MICROSECONDS in time functionsMaintains traditional MySQL syntax
Plugin APIMariaDB has a different plugin API, a revised version to allow more flexibility and controlUses MySQL Plugin API

Technical Explanations

1. Authentication Plugin Changes:

While both databases use password exchange during authentication, MariaDB has introduced the ed25519 plugin for password exchange which is more secure than the mysql_native_password mechanism. Here is a basic authentication flow using MariaDB's native password:

sql
1-- MariaDB Native Password Exchange
2> SET AUTHENTICATION_STRING = PASSWORD('user_password');
3> CHECKSUM160(BIN180XOR( SCRAMBLE(PASSWORD('user_password')) ));
4

2. JSON and Data Handling:

MariaDB's JSON is built directly upon its storage engine instead of being implemented as a binary format as seen in MySQL. This gives users flexibility when using JSON fields because they are less restricted and more portable across different storage engines.

3. Protocol Extensions:

MariaDB enhanced the query protocol with microsecond handling in time functions. For example:

sql
-- MariaDB Microseconds Example
SELECT * FROM my_table
WHERE created_at >= NOW(6);

This enhanced functional addition is invaluable for applications that require precise timing and timestamp accuracy.

Additional Considerations

When transitioning from MySQL to MariaDB or vice versa, it is necessary to:

  • Compatibility Testing: Conduct compatibility tests for existing applications interfacing with these databases to spotlight any potentially breaking changes or deprecated features in the protocol.
  • Update Client Libraries: Ensure that client libraries used for communication are updated to support any protocol changes adopted by MariaDB.
  • Keep Abreast of Version Changes: Regularly consult the MariaDB release notes in the Knowledge Base to stay informed about updates in the protocol or new features in recent releases.

In conclusion, while differences exist between MariaDB and MySQL protocols, they tend to be subtle and are heavily documented. Properly understanding these distinctions will yield better performance optimization and feature utilization in your database endeavors. The resources provided will ensure you can access the complete MariaDB protocol documentation necessary for your needs.


Related reading
Course
Beginner
27 lessons
10 hours
System Design Fundamentals

Build a strong foundation in designing scalable, reliable distributed systems.

View the course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

System Design practice on Codemia

Work through 120+ system design problems with detailed solutions, from rate limiters to multi-region storage.

Practice system design

All Rights Reserved.