Linux Drush install error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php, line 56 I tried installing Drush with both methods listed in the drush.org documentation. I think they might be conflicting with each other if that's possible. 

When I run composer global require drush/drush all the components appear to install correctly. However when I change to a Drupal site (Using XAMPP, /opt/lampp/htdocs/sitefolder) and run drush status I get the following error: 


  PHP Fatal error:  Undefined class constant 'MYSQL_ATTR_SSL_CA' in
  phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php on line 56
  Drush command terminated abnormally due to an unrecoverable error.
  [error] Error: Undefined class constant 'MYSQL_ATTR_SSL_CA' in
  phar:///usr/local/bin/drush/lib/Drush/Sql/Sqlmysql.php, line 56


I do have the following line in my ~/.bashrc:

export PATH="$HOME/.composer/vendor/bin:$PATH"

Unfortunately I don't know how to troubleshoot from here, as there doesn't seem to be an easy way to uninstall Drush via the main method (http://docs.drush.org/en/master/install/), which didn't seem to work for me. composer global remove drush/drush does appear to run successfully.

Thanks in advance.
In my case, not all of the PHP packages made it though the Ubuntu upgrade to 16.04 (which now runs PHP 7 by default).  I needed to add the missing one, and then Drush started working again:

sudo apt install php-mysql


Or for php5 users

sudo apt install php5-mysql 


on very recent Ubuntu/Debian distributions.

For PHP 7.1:

sudo apt install php7.1-mysql


For PHP 7.2:

sudo apt install php7.2-mysql


You can search for your version using this:

apt-cache search php-mysql