In this KB
- Connecting to server via SFTP
- Uploading Magento code to WordPress web root
- Deploying blank PHP application
- Restoring Magento Database
- Connecting Magento store to new database
In this tutorial, we explain how you can get more than one database for your application. As an example, we are going to deploy a WordPress application that blends with a Magento store using a different database.
Note: Multiple databases per application, even if achievable, is not currently fully supported on our platform. Specifically, you need to be aware of restore caveats (you need to restore all applications you have launched to get additional databases), and the cloning process may not work properly. Contact support for more information.
Step 1: Go to Application Management
Log into the Cloudways Platform with your credentials. Click on Applications in the top menu bar and then select your target application from the list.
Step 2: Connect to the Server via SFTP
Get your SFTP credentials under Server Management.
Connect to the server via SFTP using your favorite SFTP client.
Step 3: Upload your Magento Code to the WordPress Web Root
Step 4: Deploy a New Blank PHP Application
To provide a new database for your Magento store, we need to deploy a blank application to the same server. This guide will assist you on how to add an application. Choose PHP Stack while adding the application.
Once the application deployment is done, select the newly added PHP application from the list under the Applications area.
Step 5: Restore Magento database
As said, we use the database provided by the new blank PHP Stack application as the Magento database. Click the Access Detail section from the Application Management section and note down MySQL Access details (DB Name, Username, Password) to be used in the next Step.
Now, click on Launch Database Manager. It opens a new window to manage your database, as shown in the image below.
It is an entirely empty database. Import (restore) your Magento database.
Open your Magento database dump.
Execute the import.
Step 6: Connect Your Magento Store to the New Database
Input the PHP application’s database credentials that we took down in the previous step (Step 5) in the Magento local.xml configuration file. You can edit the file via SFTP, SSH or your preferred method.
That’s it. You have now an application using two databases. Do NOT delete the PHP Stack application, as it provides the database for the Magento store.
If you need additional databases, you can add new PHP Stack applications and repeat the process.
Of course, this can be generalized to any other kind of situation where an application may need multiple databases (which is common for example in custom PHP applications).