Any CLI scripts run on the Moodle server run with full admin access. The error states that this is an issue with PHP not having the mysqli extension configured correctly, which means it cannot connect to the database.
Take a look at your php.ini file and make sure it includes a line like extension=php_mysqli.so
.