I moved my site from one server to another in the same way I moved another site. But it won't get out of maintenance mode.

I can access phpMyAdmin and I can access the server files easily.

I've tried /user and /q=user.

Any suggestions?


There is a few things you can try.

1. Using drush

Go to root of the website and run this drush commands one by one:

drush vset maintenance_mode 0
drush cc all

2. Using database query

Go to phpmyadmin and run this db statement in order to update the "maintenance_mode" property in the variable table to "i:0;":

UPDATE `variable` SET `value` = 'i:0;' WHERE `name` = 'maintenance_mode';

3. Login as admin programatically

Make copy of the index.php file and call it what every want (maintenance.php for example) and at the end of the file replace



global $user;
$user = user_load(1);

go to that file (like [your_website]/maintenance.php), after that just disable maintenance mode and don't forget to remove this file after you finish.

4. Manually set maintenance_mode variable in index.php

Edit index.php file and put

variable_set('maintenance_mode', 0);

just before


5. Configure maintenance mode in settings.php file

At the end of your settings.php file put

$conf['maintenance_mode'] = 0;

Just go to /user/login, it works even in maintenance mode, and then sign in as an admin.

  • 1
    Since the OP moved the site, this is probably the first step to do. Amazingly, the other answers didn't point out this simple step, which would not even require Drush.
    – apaderno
    Jun 21 '16 at 6:25

Using Drush in D8, one can do:

drush state-set system.maintenance_mode 0

To turn maintenance mode back on:

drush state-set system.maintenance_mode 1

And you can also get out maintenance mode by admin/config/development/maintenance under the tab you can able enable or disabled it.

  • 1
    Since the OP moved the site, they need to first log in. Then, they can access that page to change the settings.
    – apaderno
    Jun 21 '16 at 6:44

On Drupal-8-0-0 #1-5 did not work for me above.

1-5 Result:

1. Using drush

  • vset invalid placeholder !default FormattableMarjup.php:240

2. Using database query

  • variable table not found

3. Login as admin programatically

4 - **Manually set maintenance_mode variable in index.php

  • variable_set('maintenance_mode', 0); //UNKNOWN

5 - **Configure maintenance mode in settings.php file

  • $conf['maintenance_mode'] = 0; //Didn't work for D8


  • Find code in index.php in site root (Line 22):

    • $kernel->terminate($request, $response);
  • Insert This Line of Code above line 22 & below line 20

    • \Drupal::state()->set('system.maintenance_mode', FALSE);
  • Browse to your site homepage

Final Step: Remove code maintenance code from index.php:

  • \Drupal::state()->set('system.maintenance_mode', FALSE);
  • 2
    There is no need to do such a thing. You could use Drush, or simply access /user/login to login and then change the setting.
    – apaderno
    Jun 21 '16 at 6:27
  • 1
    In the previous RC D8 version release, that functionality wasn't working yet and was a bug. Nov 30 '17 at 19:42

On Drupal 8

If your drush does not have access to mysql but you have access to mysql console you could try this

UPDATE `key_value` SET `value` = 'i:0;' WHERE `name` LIKE '%maintenance_mode%'
  • that worked for me.. thanks a lot alex May 29 '19 at 16:03

On Drupal 8.1.1 the following drush commands worked for me:

  • change directory to webroot
  • drush sset system.maintenance_mode 0
  • drush cache-rebuild
  • refresh homepage and login.

I've encountered the OP's issue after moving sites from one server to another, and it was because the database didn't fully import.

Compare the list of DB tables on the new server to the list of tables on the old server. If it's incomplete then it's likely you imported the DB through something like PHP MyAdmin and it wasn't fully imported.

You can import off the filesystem with mysql -u username -p dbname < filename.sql, or try using a script like bigdump.php.

You could also try reducing the file size of the imported DB file. Either clean out junk data that you don't need, or export the DB to multiple files with a subset of the tables in each.

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.