User login

When naming projects that will spawn a database, be mindful of 16 character limit

Stefan has set up fantastic tools using Git and Capistrano and Rake to rapidly set up Drupal projects for Agaric. This documentation, private on MyAgaric.com, will be generalized and made public once we've worked out more bugs in the system.

This post isn't about this system specifically so much as a general caution.

If you have any setup to aid your deployment that automatically makes a database or user based on your project name, you have to be aware of MySQL's 16 character limit and do something to address this before the errors.

In this case editing the Capfile afterward works. In the automatically created version the set :db_name line is set to "drupal\_#{application}" and the db_name to application. These auto-generated names – which meant the database name was "drupal_economicsforabetterworld" and the username "economicsforabetterworld" (far too long) have been replaced with the shortened acronym in the edited capfile excerpt shown below:

# vim:ft=ruby:ts=2:sw=2:et:
load "config/agaric.rb"

# Project configuration
set :application, "economicsforabetterworld"

# Webserver configuration
set :sites_available, "/etc/apache2/sites-available"
set :drupal_root, "/var/www/#{application}/drupal"

# Database configuration
set :db_file, "--defaults-file=/etc/mysql/drupal.cnf"
set :db_name, "efabw"
set :db_user, "efabw"
set :db_password do
  chars = (('a'..'z').to_a + ('A'..'Z').to_a + ('0'..'9').to_a)
  (1..8).collect{|a| chars[rand(chars.size)]}.join
end

Resolution

Searched words: 
character limits in mysql table names spotting issues in advance

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.
  • You can use Markdown syntax to format and style the text. Also see Markdown Extra for tables, footnotes, and more.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <img> <blockquote> <small> <h2> <h3> <h4> <h5> <h6> <sub> <sup> <p> <br> <strike> <table> <tr> <td> <thead> <th> <tbody> <tt> <output>
  • Lines and paragraphs break automatically.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.