Starting with 11.0.6, using mysqli:// protocol no longer works, but the error message is obscure; improve the error message
Is your feature request related to a problem? Please describe.
Until 11.0.5, using mysqli:// in the --db-url paramter of drush si always works, however starting 11.0.6 it gives a hard-to-understand error message.
For example:
composer require -W drush/drush:11.0.5
rm sites/default/settings.php
drush si -y --db-url "mysqli://root:drupal@mysql/drupal" standard
# [success] Installation complete. User name: admin User password: ***
composer require -W drush/drush:11.0.6
rm sites/default/settings.php
drush si -y --db-url "mysqli://root:drupal@mysql/drupal" standard
The above results in:
In install.core.inc line 971:
Database name field is required.
Database username field is required.
Resolve all issues below to continue the installation. For help configuring your database server, see the <a href="https://www.drupal.org/docs/8/install">in
stallation handbook</a>, or contact your hosting provider.<div class="item-list"><ul><li>Failed to connect to your database server. The server reports the f
ollowing message: <em class="placeholder">SQLSTATE[HY000] [2002] No such file or directory</em>.<ul><li>Is the database server running?</li><li>Does the dat
abase exist or does the database user have sufficient privileges to create the database?</li><li>Have you entered the correct database name?</li><li>Have yo
u entered the correct username and password?</li><li>Have you entered the correct database hostname and port number?</li></ul></li></ul></div>
Describe the solution you'd like
Instead of the error message above, perhaps it would be better to say something like:
[error] The mysqli://... protocol is deprecated; please use mysql:// instead.
Describe alternatives you've considered
The following works (mysql instead of mysqli):
drush si -y --db-url "mysql://root:drupal@mysql/drupal" standard
Additional context
The current error message can be confusing and I found the problem after a few hours of debugging.
Did Drupal change or Drush changed?
It would be good to link to the issue where mysqli became unusable.
@weitzman I think Drush has changed because based on my tests mysqli works with Drupal 9 and Drush 11.0.5, but not with Drupal 9 and Drush 11.0.6.
I found a reference to mysqli in the diff between 11.0.5 and 11.0.6, this shows that #5070, which was meant to fix #5069, introduces this code change at line 610:
- 'driver' => $url->scheme == 'mysqli' ? 'mysql' : $url->scheme,
+ 'driver' => $url->scheme,
Thanks for the research. And I'm sorry for the breakage ... The mysqli protocol isnt exactly deprecated. In that issue you linked to, the author is developing a drush driver for it. So we'll have to say something different in our error message.