I am trying to install my live drupal (version 8) website in localhost. I have downloaded the files and folders. I have imported the database. And updated settings.php file.

But when I try to log in, after entering username and password, the page redirects to core/install.php and I get this message - "Drupal already installed".

what does this mean? How can I resolve this?

enter image description here

  • Hey Suja, welcome to Drupal Answers. We love to help you. And we need more info about your setup. OS? Composer? Under what URL do you access the site locally? First wild guess would be to check your .htaccess that RewriteBase / is set. – leymannx Oct 22 '18 at 19:35
  • @leymannx Thanks...My OS is Windows-10..I am using XAMPP v3.3.2 (PHP Version 7.0.32). URL is localhost:8080/MyTestSite/testsite.com and the login URL is localhost:8080/MyTestSite/testsite.com/user/login...... After log in, after entering username and password, page redirects to localhost:8080/MyTestSite/testsite.com/core/install.php.... In .htaccess, I can see this: # RewriteBase /drupal ...Should I edit here? – web_developer Oct 22 '18 at 19:58
  • # RewriteBase /drupal should become RewriteBase /MyTestSite/testsite.com (yes, without the # at the beginning). – leymannx Oct 22 '18 at 20:01
  • @leymannx I have modified RewriteBase, restarted XAMPP, cleared browser cache, but still, the page redirects to core/install.php – web_developer Oct 22 '18 at 20:16
  • "I have imported the database." What database, and from where? – Free Radical Oct 23 '18 at 7:33

This error message is shown when you try to install Drupal, but the Drupal install script detects that there is already a populated (i.e. not empty) database present in the database pointed to by settings.php.

Here is how you set up an empty database to hold Drupal (provided the database is named "drupal").

$ mysql -u root -p
mysql> DROP DATEBASE drupal;
mysql> CREATE DATABASE drupal;
mysql> GRANT USAGE ON *.* TO drupal@localhost IDENTIFIED BY 'password';
    -> LOCK TABLES, CREATE TEMPORARY TABLES ON drupal.* TO drupal@localhost
    -> IDENTIFIED BY 'password';
mysql> quit

This will create an empty database named "drupal", belonging to a database user named "drupal", with the passord "password". (Choose a more obscure password than "password".)

Then delete settings.php and copy default.settings.php to settings.php. Do not edit it. Make sure the directory where settings.php lives and settings.php itself is writable by the web server. That will make the install script create a new settings.php with the correct values during the install.

After doing all this: Start again installing Drupal.

After installation is complete, change the permissions for settings.php and its directory back to safe values. Check that there are no warnings in the Drupal status report.

  • thank you....I am trying to recreate a live drupal website locally.....I have imported the live website's database locally...downloaded the live website's files and folders... – web_developer Oct 23 '18 at 11:42
  • If I delete settings.php, it will be like a fresh drupal installation..I need my live website's database.. – web_developer Oct 23 '18 at 11:44
  • @Suja – He just wants you to run the default installation. To ensure everything gets created properly. And when this is done, simply drop the database drush sql-drop -y and import your live database drush sql-cli < /path/to/live/db/dump.sql. – leymannx Oct 23 '18 at 13:12
  • I've tried this. Still getting the same result. – web_developer Oct 23 '18 at 18:09

The problem is Drupal installation has detected an existing installation using active configuration on settings.php.

The easiest way to get rid of this error is to replace settings.php under sites/default/ directory with content from default.settings.php file.

  • Thanks. I did this. But after importing database from the live server, I get the same 'Drupal already installed' message. – web_developer Oct 23 '18 at 18:11
  • @Suja, Drupal creates a unique UUID for each installation. If you have Drush installed on both machine try to check if both UUIDs are the same. In order to get uuid using Drush run this command. drush config-get "system.site" uuid And you can set uuid value using Drush by running drush config-set "system.site" uuid 'uuid value' This is rarely the issue as you are actually importing the database from your production site. Also, make sure to clear cache once you complete import the database to your localhost. – Hunde Tekle Oct 24 '18 at 14:17

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.