Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hello Michael.
I thought I'd share this code for people who might want to use Quickstart with longer domain names.
The following addresses the limitation on char length in the DB name or username.
//md5 the domain name to get a unique domain id
$db_domain = md5($options['domain']);
//trim it down, trusting the md5 remains unique enough in its first 13 chars
$db_domain = substr($db_domain, 0, 12);
//add a qs (QuickStart) to the front of the string so it does not potentially start with an integer
$db_domain = 'qs'.$db_domain;
//then set $defaults['domain_']
$defaults['domain_'] = $domain_ = $db_domain;
To use this, one would have to "hack" the quickstart_params function by commenting out:
if (strlen($options['domain']) > 15) {
$ret['fail'] = true;
drush_log(" '--domain' must be less than 16 characters long, for mysql user name to work.", 'error');
}
All the best.
--Sean
Comments
Comment #1
MichaelCole CreditAttribution: MichaelCole commentedHi Sean,
Thanks for this. I think having the db-name as a hash would make phpmyadmin hard to use. "Wait, which database am I working with?"
Cool that you found something that works for you though.
BTW, you can edit the dns and apache entries like you would any LAMP app. Just go to the ~/websites/config folder.
Cheers,
Mike
Comment #2
MichaelCole CreditAttribution: MichaelCole commentedThis is possible because db names can be 64 characters in MySQL 5.x
db users must be 16 chars, but it's not a problem to use the same db user, as long as I don't delete them.
Investigate :-)
Comment #3
MichaelCole CreditAttribution: MichaelCole commentedhttp://dev.mysql.com/doc/refman/5.0/en/identifiers.html
http://dev.mysql.com/doc/refman/5.0/en/user-names.html
Comment #4
caschbre CreditAttribution: caschbre commentedI would also be interested in allowing the domain to be more than 16 characters. Is there a way to parameterize this so that the myqsqlusername is provided as another parameter (and required) to allow a domain to be more than 16 characters?
I realize we can manually adjust the dns and apache entries but one of the advantages of quickstart are the scripts that handle that for you.
Comment #5
MichaelCole CreditAttribution: MichaelCole commentedComment #6
ed@edburton.net CreditAttribution: ed@edburton.net commentedSorry to ask a newb question, could somebody explain in more details how I implement the aforementioned "The following addresses the limitation on char length in the DB name or username..." and "To use this, one would have to "hack" the quickstart_params function by commenting out:...". Hopefully this might be as easy as telling me the path to two files to edit?
Comment #7
Chris CharltonNoting the request in here is a duplicate of http://drupal.org/node/1007882.
Comment #8
KLicheR CreditAttribution: KLicheR commentedI've made a similar patch here: http://drupal.org/node/1007882#comment-5867096
It use a hash only if the domain name is longer than 8 characters and if it is, the 8 firsts characters are preserved so it's usable in phpMyAdmin.