38

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

HenchHacker
  • 1,616
  • 1
  • 10
  • 16
  • 7
    MariaDB is a "drop-in replacement" for MySQL. That means that PHP thinks it's talking to MySQL, but really it's talking to MariaDB. Just install MariaDB, setup PDO to use MySQL, and it'll work :-) – gen_Eric Apr 24 '13 at 14:47
  • In theory I'm assuming it "should" as well but i'm asking here for a definite yes or not and not a "should do" and maybe expand the answer by including any issues/gotchas that may have appeared in practice when you did it yourself. – HenchHacker Apr 24 '13 at 15:08

2 Answers2

29

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

Máté Gelei
  • 869
  • 6
  • 8
5

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.

Your Common Sense
  • 156,878
  • 40
  • 214
  • 345