$databases['default']['default'] = array (
  'database' => 'baba',
  'username' => 'abab',
  'password' => 'abcbc@',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
  'driver' => 'mysql',

$databases['abcb']['default'] = array (
  'database' => 'ababc',
  'username' => 'abcb',
  'password' => 'Sabbs',
  'prefix' => '',
  'host' => 'localhost',
  'port' => '3306',
  'driver' => 'mysqli',

We have mysql, pgsql and sqlite driver but I wanted to integrate a mysqli driver in drupal ? How can I achieve it or fetch table from mysqli database in mysql database ?

1 Answer 1


Drupal 8 uses PDO, so I think mysqli is not supported.

From the documentation:

Drupal's database abstraction layer provides a unified database query API that can query different underlying databases. It is built upon PHP's PDO (PHP Data Objects) database API, and inherits much of its syntax and semantics.

  • is there any way I can fetch tables from mysqli database in drupal 8 ?
    – harshal
    Jan 20, 2016 at 10:22
  • 1
    @harshal mysqli isn't a database type, it stands for "MySQL Improved", as in the improved MySQL extension for PHP. The mysqli library was used, and arguably shouldn't be used any more, to connect to MySQL databases. There's no reason, nor option, to use the old library in Drupal 8 - it's 2016, we have better ways of solving problems (i.e. PDO). Incidentally, mysqli was not supported in Drupal 7 either, so we're going back more than 5 years since this was available in Drupal at all
    – Clive
    Jan 20, 2016 at 11:06
  • Yes thanks for your comments. But the issue I am facing is I have a drupal 6 site and another drupal 8 site . and task is to fetch database from drupal 6 table using mysqli and move it to drupal 8 website. Can this be done by using some custom module ? I was trying to use views_database_connector module to support this but could not accomplsh it.So my last question would be can it be done in drupal 8 by some way ?
    – harshal
    Jan 20, 2016 at 13:56
  • But the database itself is a mysql database, so why don't you just connect via PDO? As Clive already said, there is no mysqli database.
    – Linus
    Jan 20, 2016 at 14:11
  • It is possible to write a driver that uses mysqli, and that would also probably need to re-implement all of the SQL services such as Entity Query and Views Query in addition to all of the database. The apdqc module does something similar for Drupal 7. If you're tasked with moving data from drupal 6 to drupal 8, then you should use migrate. Writing a driver in this case is probably not recommended.
    – mradcliffe
    Jan 20, 2016 at 14:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.