Hello friends, today I will show you how to transfer Drupal website from localhost to live server. Many people like to build their Drupal site locally. Once you have finished the development on localhost, the next step is to transfer drupal website and make it live. In this article, I will show you how to transfer Drupal website from local server to a live site. By using this process, you would be able to migrate all of your content (articles, pages, images, etc), themes, as well as modules from local server to a production site.
I assume, you build a drupal site in your local server. Now you transfer your local site to live server. You would need to have a FTP program to connect your local system to live server. For that you have to know how to use ftp, so you can connect your local system with live server, upload your local site to the live site. For ftp you can use filezilla. It is free software. Now I start the process.
Step 1: Export Local Drupal Database
First thing you would like to try and do is export your native Drupal database info from localhost. I an using phpMyAdmin to try and do that. Now go to http://localhost/phpmyadmin and select your localhost joomla database. Next, click on the “Export” button from the top menu bar.
When you will export your database of Drupal website you must empty the cache tables before export all tables. There are few tables in Drupal starting with ‘cache_’ or ‘
In the Export Method option choose custom, which will provide you with more options to export your database. Select all tables to export and export it in .sql file. Scroll down to the bottom of the page and press the Go button to download your database.
Step 2: Uploading Drupal Files to Live Site
Now open an FTP client and connect to your live site. Once you are connected to your live site, make sure you upload the files in the right directory. For example if you want the site to be hosted on yoursite.com, then you would want to upload all files in your public_html directory.
Now select your local Drupal files and upload them to your live server. I upload my site in a sub folder but you upload into public_html
It takes time so do not worry. Leave it, it will upload all files from local server to live server.
Step 3: Creating MySQL Database on Live Site
While your FTP client is uploading your Drupal files, you can spend this time on importing your database to the live server. Now login to your cPanel by entering the given login details by your server administrator after buying the hosting and domain. After log in to your cPanel dashboard and click on the MySQL databases icon which can be found in the databases section.
On the next screen, create a database by entering a name for your database.
After creating a database, scroll down to MySQL users section and create or add an existing user to the database. After adding the user, cPanel will take you to set MySQL privileges for that user. Simply grant all privileges to the user.
Step 4: Importing Drupal Database on Live Site
Next step in the process is to import your Drupal database. Go to your cPanel dashboard, scroll down to the databases section and click on phpMyAdmin. This will take you to phpMyAdmin where you want to click on the database you created earlier. phpMyAdmin will show your new database with no tables. Click on the Import tab in the top menu. On the import page, click on choose file button and then select the .sql database file you saved in step 1. Lastly, press the Go button at the bottom of the page. phpMyadmin will now import your Drupal database.
Step 5: Changing the Site settings
Open your settings.php file available at sites/default/settings.php to match your localhost sql settings. It will require database name, database server username, database server password, and database prefix (if you have).
Testing your Drupal Website
Now open your Drupal website by entering the proper url of the site.
That’s all, hopefully your live site will be up and running by now. Checkout your site to make sure that every thing is working fine as expected. For troubleshooting and questions feel free to leave us a comment below and we will try to help out as much as we can.