更改Magento数据库

时间:2019-07-03 09:07:56

标签: mysql magento magento-1.7

我已经用数据库名称magento1.7安装了magento 1.7,现在我想用名称为magento的当前活动转储替换它。

我更改了local.xml和config.xml中的dbname,清除了magento中的缓存和其他内容。但是现在我在加载magento local时遇到了以下错误。

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '921923' for key 'PRIMARY'

Trace:
#0 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Statement.php(300): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#3 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Varien/Db/Adapter/Pdo/Mysql.php(419): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 /Applications/XAMPP/xamppfiles/htdocs/magento/lib/Zend/Db/Adapter/Abstract.php(574): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Resource/Visitor.php(174): Zend_Db_Adapter_Abstract->insert('log_visitor_inf...', Array)
#7 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Resource/Visitor.php(108): Mage_Log_Model_Resource_Visitor->_saveVisitorInfo(Object(Mage_Log_Model_Visitor))
#8 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/Resource/Db/Abstract.php(463): Mage_Log_Model_Resource_Visitor->_afterSave(Object(Mage_Log_Model_Visitor))
#9 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#10 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Log/Model/Visitor.php(167): Mage_Core_Model_Abstract->save()
#11 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#12 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#13 /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php(447): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#14 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(528): Mage::dispatchEvent('controller_acti...', Array)
#15 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Front/Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#16 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Action.php(408): Mage_Core_Controller_Front_Action->preDispatch()
#17 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#18 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Controller/Varien/Front.php(176): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#19 /Applications/XAMPP/xamppfiles/htdocs/magento/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#20 /Applications/XAMPP/xamppfiles/htdocs/magento/app/Mage.php(683): Mage_Core_Model_App->run(Array)
#21 /Applications/XAMPP/xamppfiles/htdocs/magento/index.php(87): Mage::run('', 'store')

我在日志表中搜索了值“ 921923”,但找不到任何匹配项。有人可以帮助/指导我解决此问题吗?

1 个答案:

答案 0 :(得分:0)

SET FOREIGN_KEY_CHECKS=0;

然后导入并删除log_visitor_inf ..表中的所有值,然后运行您的网站。删除此文件夹var,然后检查网站。