Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Starting with 11.0.6, using mysqli:// protocol no longer works, but the error message is obscure; improve the error message #5094

Open
alberto56 opened this issue Mar 14, 2022 · 4 comments

Comments

@alberto56
Copy link

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.

alberto56 added a commit to dcycle/word_monitor that referenced this issue Mar 14, 2022
@weitzman
Copy link
Member

Did Drupal change or Drush changed?

@weitzman
Copy link
Member

It would be good to link to the issue where mysqli became unusable.

@alberto56
Copy link
Author

@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,

@weitzman
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants