Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDO and MariaDB

Tags:

php

pdo

mariadb

I've been using PDO in PHP for a while now utilizing MySQL.

However, recent developments have made me think that MySQL will start fading out in replacement of MariaDB especially since MariaDB:

  • Consider themselves many developer years ahead of MySQL without putting new developments into paid areas (clustering for example).
  • The majority of the main MySQL developers moved to MariaDB after Oracle took over.
  • Is becoming the default database to replace MySQL on various Linux distributions.
  • Is a drop in replacement of MySQL and large companies are starting to adopt MariaDB such as Wikipedia (Read the blog post here).

So my question is, since MariaDB doesn't appear to be listed in the PDO drivers and seeing as MariaDB is designed to be a "drop in replacement" and could potentially phase out MySQL in the future.

Can I use the MySQL PDO driver with a MariaDB database, at least until an official MariaDB driver becomes available?

Links

  • PDO
  • MySQL
  • MariaDB
like image 739
HenchHacker Avatar asked Apr 24 '13 14:04

HenchHacker


People also ask

Does PDO work with MariaDB?

Connecting to and communicating with an underlying MariaDB database is facilitated by the PDO extension.

Can I use PDO with MySQL?

PDO will work on 12 different database systems, whereas MySQLi will only work with MySQL databases. So, if you have to switch your project to use another database, PDO makes the process easy. You only have to change the connection string and a few queries.

What is difference between PDO and MySQL?

MySQLi is a replacement for the mysql functions, with object-oriented and procedural versions. It has support for prepared statements. PDO (PHP Data Objects) is a general database abstraction layer with support for MySQL among many other databases.


2 Answers

MariaDB and MySQL are 100% 99% compatible. This includes connector compatibility.

edit: up to the point that MariaDB tools are shipped as MySQL tools (e.g. mysqldump), and data files are binary compatible, too

like image 86
Máté Gelei Avatar answered Sep 20 '22 09:09

Máté Gelei


Can I use the MySQL PDO driver with a MariaDB database, at least until an official MariaDB driver becomes available?

Yes.

As well as Percona or any other fork that being old good mysql in it's core.

like image 42
Your Common Sense Avatar answered Sep 22 '22 09:09

Your Common Sense