title: Connect Magento to Google Cloud SQL as MySQL Server Error
body: <p>I uploaded an already working database to Google Cloud SQL and I changed config.xml and local.xml. The connection data I filled in is working. I also tried the connection to the Google Cloud SQL database with a wordpress testversion. It has to be something else.</p>
  
  <p>config.xml like:</p>
  
  <pre><code>&lt;host&gt;google cloud server ip&lt;/host&gt;
                      &lt;username&gt;root&lt;/username&gt;
                      &lt;password&gt;mypassword&lt;/password&gt;
                      &lt;dbname&gt;magento&lt;/dbname&gt;
                      &lt;model&gt;mysql4&lt;/model&gt;
                      &lt;initStatements&gt;SET NAMES utf8&lt;/initStatements&gt;
                      &lt;type&gt;pdo_mysql&lt;/type&gt;
                      &lt;active&gt;0&lt;/active&gt;
  </code></pre>
  
  <p>local.xml like:</p>
  
  <pre><code>&lt;host&gt;&lt;![CDATA[google cloud server ip]]&gt;&lt;/host&gt;
                      &lt;username&gt;&lt;![CDATA[root]]&gt;&lt;/username&gt;
                      &lt;password&gt;&lt;![CDATA[mypassword]]&gt;&lt;/password&gt;
                      &lt;dbname&gt;&lt;![CDATA[magento&lt;]]&gt;&lt;/dbname&gt;
                      &lt;initStatements&gt;&lt;![CDATA[SET NAMES utf8]]&gt;&lt;/initStatements&gt;
                      &lt;model&gt;&lt;![CDATA[mysql4]]&gt;&lt;/model&gt;
                      &lt;type&gt;&lt;![CDATA[pdo_mysql]]&gt;&lt;/type&gt;
                      &lt;active&gt;1&lt;/active&gt;
  </code></pre>
  
  <p>I get 2 different errors: </p>
  
  <pre><code>SQLSTATE[HY000] [2002] Connection refused
  SQLSTATE[HY000] [2002] Connection timeout
  </code></pre>
  
  <p>with this message:</p>
  
  <pre><code>#0 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract-&gt;_connect()
  #1 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql-&gt;_connect()
  #2 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql-&gt;_connect()
  #3 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract-&gt;query('SET NAMES utf8', Array)
  #4 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract-&gt;query('SET NAMES utf8', Array)
  #5 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Resource.php(169): Varien_Db_Adapter_Pdo_Mysql-&gt;query('SET NAMES utf8')
  #6 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Resource.php(110): Mage_Core_Model_Resource-&gt;_newConnection('pdo_mysql', Object(Mage_Core_Model_Config_Element))
  #7 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(320): Mage_Core_Model_Resource-&gt;getConnection('core_write')
  #8 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(350): Mage_Core_Model_Resource_Db_Abstract-&gt;_getConnection('write')
  #9 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(335): Mage_Core_Model_Resource_Db_Abstract-&gt;_getWriteAdapter()
  #10 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Resource/Cache.php(53): Mage_Core_Model_Resource_Db_Abstract-&gt;_getReadAdapter()
  #11 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/var/cache/ew/files/7a/3e/Mage/Core/Model/Cache.php(497): Mage_Core_Model_Resource_Cache-&gt;getAllOptions()
  #12 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/var/cache/ew/files/7a/3e/Mage/Core/Model/Cache.php(539): Mage_Core_Model_CacheOverriddenClass-&gt;_initOptions()
  #13 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/App.php(1183): Mage_Core_Model_CacheOverriddenClass-&gt;canUse('config')
  #14 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Config.php(414): Mage_Core_Model_App-&gt;useCache('config')
  #15 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/Config.php(294): Mage_Core_Model_Config-&gt;_canUseCacheForInit()
  #16 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/App.php(413): Mage_Core_Model_Config-&gt;loadModulesCache()
  #17 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App-&gt;_initModules()
  #18 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/Mage.php(684): Mage_Core_Model_App-&gt;run(Array)
  #19 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/index.php(89): Mage::run('', 'store')
  #20 {main}
  </code></pre>