Developers often need to make changes in the “Magento database config file” for the site development purpose. For example, domain transfer, backups and editing etc. Mostly the merchants have very little knowledge about the use of MySQL databases. Specially all they knew about cPanel & admin access. Hence, in this article, we tried here to focus on use and access details of database.
There are a lot of databases under cPanel. Hence occasionally you might need just one of them for an application or website etc. Here we will take Mage database as an example.
Accessing Magento database config file
Case study: Backup
Firstly, let’s make the Mage website available. Next assume that we have FTP access but don’t have the database details. Here our task is to do a database backup. As a result, the question arises, “How to find the access credentials of that specific database?”
Now let’s move to ‘/app/etc/’ under main site DIR (Mage site installed). Then access the XML doc ‘local.xml’. Therefore, access the “local.xml” using your cPanel editor.
<default_setup>
<connection>
<host><![CDATA[site_host_name_here]]></host>
<username><![CDATA[site_username_here]]></username>
<password><![CDATA[site_pass_here]]></password>
<dbname><![CDATA[site_dbname_here]]></dbname>
<initStatements><![CDATA[names_setup_utf8]]></initStatements>
<model><![CDATA[mysql5.5]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>
That is how we can access to DB credentials using your cPanel. Lastly, Use “php mini admin” or any “php script” in your cPanel to create a backup. All you need to use accurate DB details.
Case study: Config & domain transfer
Another key point is the website transfer process. Now you are ready to transfer Mage docs and DB to another host. Hence, it is possible that you’re using new DB credentials in your new hosting server such as hostname, username, DB name and password etc. Then all you need is to access the “/app/etc/local.xml” file on new server. Now edit the DB credentials using cPanel in the new hosting server.
<connection>
<host><![CDATA[edit_host_name_here]]></host>
<username><![CDATA[edit_username_here]]></username>
<password><![CDATA[edit_pass_here]]></password>
<dbname><![CDATA[edit_dbname_here]]></dbname>
</connection>
Finally, save the updated values using the “HTML editor” to effect changes.
“Although as you can see transferring websites is bit tricky for non-developers. As a result, we’re providing 100% free website transfer services to our clients. Hence, all three plans includes the service absolutely in free of cost! So, feel free to move in with Aspiration Hosting. You can also enjoy dedicated Mage hosting with us for $9.99 per month.”
Tanzia Farin Chy for aspiration hosting