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

drush site-install creates wrong tmp file with db connection details #2888

Closed
inktrap opened this issue Aug 22, 2017 · 3 comments
Closed

drush site-install creates wrong tmp file with db connection details #2888

inktrap opened this issue Aug 22, 2017 · 3 comments

Comments

@inktrap
Copy link

inktrap commented Aug 22, 2017

I am trying to install drupal with Drush Version : 8.1.12.

Drush tries to execute the following query, based on the parameters I give it per --db-url: mysql --defaults-extra-file=/tmp/drush_wyvP09 --database=db_drupal --host=localhost --port=3307 --silent

This fails, due to incorrect settings in the tmp file. If I run this from my shell, it:

  • works, without --default-extra-file:
    mysql --database=db_drupal --host=localhost --port=3307 --silent
  • works, with an empty file:
    mysql --defaults-extra-file=~/empty --database=db_drupal --host=localhost --port=3307 --silent
  • works, with the correct file:
    mysql --defaults-extra-file=~/.my.mariadb.cnf --database=db_drupal --host=localhost --port=3307 --silent

So I guess the non-standard port number is somehow not included?! This assumption is confirmed by a cat-loop for drush tmp files:

[client] user="myusername" password="mypassword"#This file was written by Drush's Sqlmysql.php.

The non-standard port is a requirement from my hoster, who supports a more recent version of mysql along with an older version that runs on the standard port.

@inktrap
Copy link
Author

inktrap commented Aug 22, 2017

Edit: Strange, even if I create a file with wrong credentials and no linebreaks (like the line above), it works on the shell. Here is the complete error message, maybe it is unrelated to the configuration above.

Starting Drupal installation. This takes a while. Consider using the        [ok]
--notify global option.
Drupal\Core\Installer\Exception\InstallerException: Resolve all          [error]
issues below to continue the installation. For help configuring your
database server, see the <a
href="https://www.drupal.org/getting-started/install">installation
handbook</a>, or contact your hosting provider.<div
class="item-list"><ul><li>Failed to connect to your database server.
The server reports the following message: <em
class="placeholder">SQLSTATE[HY000] [1045] Access denied for user
&#039;username&#039;@&#039;localhost&#039; (using password:
YES)</em>.<ul><li>Is the database server running?</li><li>Does the
database 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 you entered the correct username and
password?</li><li>Have you entered the correct database
hostname?</li></ul></li></ul></div> in
/var/www/virtual/username/drupal/web/core/includes/install.core.inc:913
Stack trace:
#0
/var/www/virtual/username/drupal/web/core/includes/install.core.inc(584):
install_get_form('Drupal\\Core\\Ins...', Array)
#1
/var/www/virtual/username/drupal/web/core/includes/install.core.inc(540):
install_run_task(Array, Array)
#2
/var/www/virtual/username/drupal/web/core/includes/install.core.inc(117):
install_run_tasks(Array)
#3
/var/www/virtual/username/drupal/vendor/drush/drush/includes/drush.inc(726):
install_drupal(Object(Composer\Autoload\ClassLoader), Array)
#4
/var/www/virtual/username/drupal/vendor/drush/drush/includes/drush.inc(711):
drush_call_user_func_array('install_drupal', Array)
#5
/var/www/virtual/username/drupal/vendor/drush/drush/commands/core/drupal/site_install.inc(82):
drush_op('install_drupal', Object(Composer\Autoload\ClassLoader),
Array)
#6
/var/www/virtual/username/drupal/vendor/drush/drush/commands/core/site_install.drush.inc(255):
drush_core_site_install_version('standard', Array)
#7
/var/www/virtual/username/drupal/vendor/drush/drush/includes/command.inc(422):
drush_core_site_install()
#8
/var/www/virtual/username/drupal/vendor/drush/drush/includes/command.inc(231):
_drush_invoke_hooks(Array, Array)
#9
/var/www/virtual/username/drupal/vendor/drush/drush/includes/command.inc(199):
drush_command()
#10
/var/www/virtual/username/drupal/vendor/drush/drush/lib/Drush/Boot/BaseBoot.php(67):
drush_dispatch(Array)
#11
/var/www/virtual/username/drupal/vendor/drush/drush/includes/preflight.inc(66):
Drush\Boot\BaseBoot->bootstrap_and_dispatch()
#12 /var/www/virtual/username/drupal/vendor/drush/drush/drush.php(12):
drush_main()
#13 {main}
Command dispatch complete                                               [notice]

@inktrap
Copy link
Author

inktrap commented Aug 22, 2017

So clearly the db credentials are not correct.

@inktrap
Copy link
Author

inktrap commented Aug 23, 2017

My hoster provides access (to the database) via an ssh-tunnel, so 127.0.0.1 works, while localhost does not. Nothing wrong with drush. The generation of a --defaults-extra-file prevents information leakage.

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

No branches or pull requests

1 participant