gpt4 book ai didi

php - 将 Magento 连接到 Google Cloud SQL 作为 MySQL 服务器错误

转载 作者:行者123 更新时间:2023-11-29 21:36:03 25 4
gpt4 key购买 nike

我将一个已经运行的数据库上传到 Google Cloud SQL,并更改了 config.xml 和 local.xml。我填写的连接数据有效。我还尝试使用 WordPress 测试版本连接到 Google Cloud SQL 数据库。一定是别的东西。

config.xml 如下:

<host>google cloud server ip</host>
<username>root</username>
<password>mypassword</password>
<dbname>magento</dbname>
<model>mysql4</model>
<initStatements>SET NAMES utf8</initStatements>
<type>pdo_mysql</type>
<active>0</active>

local.xml 如下:

<host><![CDATA[google cloud server ip]]></host>
<username><![CDATA[root]]></username>
<password><![CDATA[mypassword]]></password>
<dbname><![CDATA[magento<]]></dbname>
<initStatements><![CDATA[SET NAMES utf8]]></initStatements>
<model><![CDATA[mysql4]]></model>
<type><![CDATA[pdo_mysql]]></type>
<active>1</active>

我收到两个不同的错误:

SQLSTATE[HY000] [2002] Connection refused
SQLSTATE[HY000] [2002] Connection timeout

带有此消息:

#0 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Varien/Db/Adapter/Pdo/Mysql.php(320): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->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->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->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->_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->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->_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->_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->_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->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->_initOptions()
#13 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/App.php(1183): Mage_Core_Model_CacheOverriddenClass->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->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->_canUseCacheForInit()
#16 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/App.php(413): Mage_Core_Model_Config->loadModulesCache()
#17 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/code/core/Mage/Core/Model/App.php(343): Mage_Core_Model_App->_initModules()
#18 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#19 /html/copy_hzlbio/var/www/vhosts/live_magento/htdocs/index.php(89): Mage::run('', 'store')
#20 {main}

最佳答案

这与 magento 或 google cloud sql 无关。这是关于 htdocs 所在的服务器。服务器不允许此传出连接。

关于php - 将 Magento 连接到 Google Cloud SQL 作为 MySQL 服务器错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34909335/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com