无法连接到Localhost上的MariaDB数据库

时间:2012-04-19 17:12:33

标签: php mysql magento magento-1.5 mariadb

我刚刚将现有Magento站点的数据库移动到新服务器上,当我在〜/ app / etc /中更改local.xml中的设置时,我在重新启动所有内容后出现以下错误:

SQLSTATE[HY000] [2013] Lost connection to MySQL server at 'reading initial communication packet', system error: 113

跟踪:

#0 /var/www/portablegaragedepot.com/www/lib/Zend/Db/Adapter/Pdo/Mysql.php(96): Zend_Db_Adapter_Pdo_Abstract->_connect()
#1 /var/www/portablegaragedepot.com/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(251): Zend_Db_Adapter_Pdo_Mysql->_connect()
#2 /var/www/portablegaragedepot.com/www/lib/Zend/Db/Adapter/Abstract.php(459): Varien_Db_Adapter_Pdo_Mysql->_connect()
#3 /var/www/portablegaragedepot.com/www/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('SET NAMES utf8', Array)
#4 /var/www/portablegaragedepot.com/www/lib/Varien/Db/Adapter/Pdo/Mysql.php(337): Zend_Db_Adapter_Pdo_Abstract->query('SET NAMES utf8', Array)
#5 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Resource/Type/Db/Pdo/Mysql.php(45): Varien_Db_Adapter_Pdo_Mysql->query('SET NAMES utf8')
#6 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Resource.php(93): Mage_Core_Model_Resource_Type_Db_Pdo_Mysql->getConnection(Object(Mage_Core_Model_Config_Element))
#7 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(297): Mage_Core_Model_Resource->getConnection('core_read')
#8 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(312): Mage_Core_Model_Mysql4_Abstract->_getConnection('read')
#9 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(332): Mage_Core_Model_Mysql4_Abstract->_getReadAdapter()
#10 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Mysql4/Collection/Abstract.php(118): Mage_Core_Model_Mysql4_Abstract->getReadConnection()
#11 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Config.php(1254): Mage_Core_Model_Mysql4_Collection_Abstract->__construct(Object(Mage_Core_Model_Mysql4_Website))
#12 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Config.php(1287): Mage_Core_Model_Config->getModelInstance('core_mysql4/web...', Object(Mage_Core_Model_Mysql4_Website))
#13 /var/www/portablegaragedepot.com/www/app/Mage.php(460): Mage_Core_Model_Config->getResourceModelInstance('core/website_co...', Object(Mage_Core_Model_Mysql4_Website))
#14 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Abstract.php(208): Mage::getResourceModel('core/website_co...', Object(Mage_Core_Model_Mysql4_Website))
#15 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/Abstract.php(213): Mage_Core_Model_Abstract->getResourceCollection()
#16 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/App.php(571): Mage_Core_Model_Abstract->getCollection()
#17 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/App.php(429): Mage_Core_Model_App->_initStores()
#18 /var/www/portablegaragedepot.com/www/app/code/core/Mage/Core/Model/App.php(335): Mage_Core_Model_App->_initCurrentStore('', 'store')
#19 /var/www/portablegaragedepot.com/www/app/Mage.php(627): Mage_Core_Model_App->run(Array)
#20 /var/www/portablegaragedepot.com/www/index.php(81): Mage::run('', 'store')
#21 {main}

我的local.xml文件的数据库设置现在如下所示:

<connection>
    <host><![CDATA[127.0.0.1]]></host>
    <username><![CDATA[****]]></username>
    <password><![CDATA[****]]></password>
    <dbname><![CDATA[****]]></dbname>
    <active>1</active>
</connection>

从localhost我可以正常运行以下命令:

mysql -h127.0.0.1 -u**** -p**** -D****

要移动数据库,我只需使用以下命令

mysqldump -h[old server] -u*** -p*** -D[old db name] > site.sql
mysql -h127.0.0.1 -u**** -p**** -D[new db name (same name)] < site.sql

我应该采用另一种方式移动数据库吗?

最后一点是我从MySQL迁移到MariaDB,但Maria和PHP的文档中的所有内容都说连接器应该可以正常工作。

0 个答案:

没有答案