I am working with drupal 7 and I install drush V7.4.0 but when i run drush cc all I am getting this error : Error: Uncaught Error: Undefined class constant 'MYSQL_ATTR_USE_BUFFERED_QUERY' in /var/www/html/myproject/includes/database/mysql/database.inc:56
2 Answers
You are missing some sort of php support for mysql.
Examine:
print phpinfo();
and see if there is a reference to PDO or pdo_mysql . Generic install for php support (it includes the pdo_mysql extension) can be done with:
sudo apt-get install php{digits}-mysql
where {digits} needs to be replaced by your php version (could be 5, 6, 7.0, 7.1). After adding this you need to include the module and need to restart apache.
Check whether MYSQL PDO extension is enabled/installed by looking into your <?php echo phpinfo(); ?>
Probably not: So please install the below extension by running the command in Ubuntu 18.04: In case php.7.3
$ sudo apt-get install php7.3-mysql
$ sudo phpenmod pdo_mysql
$ sudo service apache2 restart