How to Clone a production site locally for testing? Ok so I am kinda new to drupal (I've only been working with it for a few months at work) and I just got my first freelance client who has a drupal site that he wants to modify its layout.

I am now stuck at trying to duplicate the website and set it up on my machine and I don't want to do changes to the production environment directly.
Here's what I did so far:


I got access to the webhost server and downloaded the site's drupal root directory
I exported the site's database and stored it on my machine
Used Acquia Dev Desktop 2 to import a local site -> chose the downloaded drupal site root -> selected the sq database dump file that I exported earlier


When I try to open the site on my local server it runs the drupal installation but when I choose a profile and press "Save and continue" it shows me the following message:


  "Drupal already installed. To start over, you must empty your existing
  database. To install to a different database, edit the appropriate
  settings.php file in the sites folder."


Now I know that drupal is already installed probably because I cloned the website codebase and database exactly as they are from the webhost server, and I did not change any of the settings.php files. 
How exactly do I run the website l locally through Acquia Dev Desktop and then push my changes to the host?

Any tips, best practices comments, and advice is highly appreciated!
Most probably the problem is in your settings.php, what you can do:


Open your settings.php files and search for the folowing code:

$databases = array
'default' => 
array (
'default' => 
array (
'database' => 'your-db-name',
'username' => 'your-db-user',
'password' => 'your-db-user-password',
'host' => 'localhost',
'port' => '',
'driver' => 'mysql',
'prefix' => '', 
), 
),
);
If you are not sure if you have the correct code for your database, please post your code back in here and i will take a look on it
Last thing, if all you need is making changes to your website using a test website and then push all changes back to the production website, my suggestion is to create a subdomain on your webshost (Ex: dev.yourdomainname.com) and completely clone your entire website from dev.yourdomainname.com so you can work on your dev website without touching your production one.


I can help you with that also but first tell me what your need and answer the following:

_ You have access to Drush console ?
_ You have access to the webhost server ?

waiting your response...

Update # 1: Clone your production website for testing purposes on your webhost

1) Create a subdomain for your domain name (ex: dev.yourdomain.com)

2) From your cpanel, create a new empty database (don't forget to prefix your db name at end by _test to distinguish it from the original one) (Ex: db_name_test)

write down the name of the database

3) create a new user for your test database and also (don't forget to prefix your user name at end by _test to distinguish it from the original one)

Write down the name of the user &amp; password

4) Grant the test user all privileges for the new database.

5) goto your production site and do the following manually or by using the drush command:


Clear all caches. (drush cc all)
Disable clean URLs. (/admin/config/search/clean-urls)(drush vset clean_url 0 --yes)
Disable cron job. (/admin/config/system/cron)
Put site in maintenance mode. (drush vset maintenance_mode 1 --yes)


6) Copy the entire site's drupal root directory to the new test website root directory and make sure the settings.php file is copied as well.

Manually:
Click on the site root directory and choose copy and type the destination path.

drush command:

cp -rp /home/cpanel-user/public_html/your-original-site-root-directory /home/cpanel-user/public_html/your-dev-site-root-directory

7) Goto your phpMyAdmin, Select your original database, Choose operations, under the copy database to section, write down your test database name as it is, make sure the structure and data is selected, and uncheck create database before copying, leave everything else as it is, click Go and wait for the confirmation message.

8) Make sure the permission given to the deb-site root directory is: 0755

9) navigate to your new test website directory, edit settings.php and edit the database settings to fit the new database name, new database user &amp; new user password

10) open new tab browser and navigate to: dev.yourdomain.com

11) Voila, all should be good.

12) goto your dev site and do the following manually or by using the drush command:


Clear all caches. (drush cc all)
Enable clean URLs. (/admin/config/search/clean-urls)(drush vset clean_url 1 --yes)
Enable cron job. (/admin/config/system/cron)
Don't remove the site from the maintenance mode since it is a test website.


Note, you can do the exact steps above to have a copy of your website locally, but i will just stick with this method since it is more reliable. easier and faster.

If you insist of cloning your website locally to acquia dev desktop:

1) Get a fresh copy of your prod-site database and file, manually or using drush 

drush ard --destination=/home/cpanel-user/create-a-directory-for-backup/choose-a-name.tar.gz

The above command using drush 7, will get you a copy of your database and your files/folders.

2) Download the archive backup folder to your desktop and unzip.

3) Goto Acquia dev desktop, click on + and import local drupal site

4) Choose the local codebase folder from the unzipped folder you just downloaded.

5) choose a local site.

6) leave the create a new database and give it a new name of your choice.

7) when finish importing, visit your website and complete a new fresh installation from your website.

8) when all go good and you will have a fresh new Drupal website up and running, goto your local database (phpMyAdmin), click on Structure, Scroll down to the button, Check all tables, with selected choose drop, make sure there is no any left tables in the database.

9) Goto import, select you .sql database, leave everything as it is, click Go

10) no need to change anything inside the settings.php, just visit your site and voila.