magento 2

Magento 1.9 Exception printing is disabled and can’t connect to MySQL server errors

After moving my Magento 1.9 store to a new host I got the error below and couldn’t fit it:

Exception printing is disabled by default for security reasons.

I tried a method mentioned at HostGator (not my host) which required me to navigate to the magento/lib/Zend/Cache/Backend/File.php and change a bit of code.  Unfortunately, that did not work for me.

I also tried deleting the cache from var/cache but that didn’t work.

I had enabled the errors list to be shown on the page by going to the errors folder from root installation and changing the local.xml.sample file to just local.xml.

From there I got the error:

magento SQLSTATE[HY000] [2003] Can’t connect to MySQL server on x.x.x.x

Basically a connection error with my MySQL database.  I went to the softaculous installation and changed the details there from the old host IP address to localhost assuming that would change it but it didn’t work.

Solution

I couldn’t find the config file where the database details were stored until I visited this site.  The link is to a post that describes a different but related issue, the main thing is the file locations.

I had to change the file local.xml located in app/etc/local.xml which I had never done before.  Inside the file there was data related the connection to the database.  I simply downloaded, changed the host to localhost and left the username, password and everything else the same.

<default_setup>
<connection>
<host><![CDATA[localhost]]></host>
<username><![CDATA[db_user]]></username>
<password><![CDATA[db_pass]]></password>
<dbname><![CDATA[db_name]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<pdoType><![CDATA[]]></pdoType>
<active>1</active>
</connection>
</default_setup>

Uploaded the file and it was working again.

Similar Posts