0

I have a local multisite instance running MAMP 3.0.7.3, and I can't use the drush site-install command to do a re-install of one of my sites without actually dropping the database first.

If I try the command without dropping the database, I get the following output:

$ drush --uri="www.example.local" si -y my_great_install_profile --account-pass=admin --sites-subdir="www.example.com"
You are about to DROP all tables in your 'example_site' database. Do you want to continue? (y/n): y
<h1>Additional uncaught exception thrown while handling exception.</h1><h2>Original</h2><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;example_site.registry&amp;#039; doesn&amp;#039;t exist: SELECT filename FROM {registry} WHERE name = :name AND type = :type; Array
(
    [:name] =&amp;gt; drush_drupal_site_install
    [:type] =&amp;gt; interface
)
 in _registry_check_code() (line 3188 of /Users/gravelpot/sites/www.example.local/includes/bootstrap.inc).</p><h2>Additional</h2><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;example_site.registry&amp;#039; doesn&amp;#039;t exist: SELECT filename FROM {registry} WHERE name = :name AND type = :type; Array
(
    [:name] =&amp;gt; drush_drupal_environment
    [:type] =&amp;gt; interface
)
 in _registry_check_code() (line 3188 of /Users/gravelpot/sites/www.example.local/includes/bootstrap.inc).</p><hr />Drush command terminated abnormally due to an unrecoverable error.                                                                            [error]
<h1>Uncaught exception thrown in shutdown function.</h1><p>PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table &amp;#039;example_site.semaphore&amp;#039; doesn&amp;#039;t exist: DELETE FROM {semaphore}
WHERE  (value = :db_condition_placeholder_0) ; Array
(
    [:db_condition_placeholder_0] =&amp;gt; 1731533568552880e6a71ed3.80394544
)
 in lock_release_all() (line 269 of /Users/gravelpot/sites/www.example.local/includes/lock.inc).</p><hr />

I also have the same problem when trying to import a SQL dump file by doing something like drush sql-drop followed by drush sqlc < path/to/file.sql, which is a pattern I see suggested in a lot of blog posts.

I am using Drush 6.5 installed via composer. My co-workers have a similar configuration, and do not have this problem.

1

Make sure nothing breaks Drush calls; attempt a drush cc all to see if the error still appears, and debug if it does.

To avoid dropping the database, the simple "hacked" answer is:

  1. Edit site's settings.php file to use another database scheme (make sure it exists though).

    $databases = array (
      'example1' => 
      array (
        'example1' => array (
          'database' => 'example2', // Changed from "example1".
          'username' => 'user',
          'password' => 'pass',
        ),
      ),
    );
    
  2. Use site-instal . This will drop "Example2" and install the site there, without hurting the original database.

  3. Edit the site's configuration file back to original database scheme.

You need to use backquotes on the "drush sqlc" part:``drush sql-connect`` < path/to/file.sql.

  • Nothing else with Drush breaks other than this. Everything else is fine. Your "hacked" answer is legit, and I appreciate it, but I'm really looking for what's wrong/different with my setup that causes it not to work like every else's. – gravelpot Apr 11 '15 at 16:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.