Messing with phpunit.xml is a pain, we should just read creds from ~/.my.cnf if it exists.

Attached patch seems to work for me.

CommentFileSizeAuthor
drush_test_my_cnf.patch1.34 KBmsonnabaum

Comments

jonhattan’s picture

Status: Active » Reviewed & tested by the community

nice addition. It also works for me

moshe weitzman’s picture

Status: Reviewed & tested by the community » Needs work
  1. Should we look in more places than ~? See http://dev.mysql.com/doc/refman/5.1/en/option-files.html for more possible locations.
  2. According to that page, [client] group con contain socket and port as well. We should support those. I would add support for 'host' as well.
  3. I'd like to see this restructured so it is clearer that we try ENV, GLOBALS, my.cnf, and defaults in that order.
  4. $_SERVER['HOME'] . '/.my.cnf' appears twice.
moshe weitzman’s picture

Should we not consult the php.ini settings - http://us.php.net/manual/en/mysql.configuration.php as well. Not sure what takes precedence.

owen barton’s picture

Just noticed this also - I think it would be good if this worked in sql commands also (plus si etc), in addition to the tests. We would need to figure out behaviour - I think the ideal would be to allow db-url to include partial URLs (in a similar way to runserver - we could probably repurpose the code) such that the unknowns are filled in by the values found in my.cnf's/php.ini if possible. So if you have your user/pass/host/port in my.cnf, you could just use something along the lines of --db-url=mysql://databasename.

bryan kennedy’s picture

Version: » All-versions-4.x-dev
Issue tags: +MySQL, +Security, +password

I agree that this patch needs some work, but I just wanted to mention that this would be useful to get fixed. Right now when my deploy scripts roll out a site, I have to pass the mysql credentials in the open to Drush. I think deploy systems that use Drush would be the primarily beneficiary from this change.

bryan kennedy’s picture

Status: Needs work » Closed (duplicate)

Actually after doing some searching, I am wondering if it's valid to mark this as a duplicate of this longer conversation about this same issue:

http://drupal.org/node/671906

In the interest of starting up the conversation again, but in only one place, I'm going to go ahead and mark this as closed(duplicate), but feel free to correct me if someone disagrees.