Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

magento frondend show error 1062 Duplicate entry '0' for key 'PRIMARY'

My Magento frontend does not load and shows errors.
How I can fix this?

Notice: the error shows after I import the category table (I know that's wrong).

I'm a beginner in Magento.

Thank you for any help.

There has been an error processing your request

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '0' for key 'PRIMARY', query was: INSERT INTO `log_visitor` (`session_id`, `first_visit_at`, `last_visit_at`, `last_url_id`, `store_id`) VALUES (?, ?, ?, ?, ?)

Trace:
#0 D:\xampp\htdocs\magento\magento-orginal\lib\Varien\Db\Statement\Pdo\Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Zend\Db\Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 D:\xampp\htdocs\magento\magento-orginal\lib\Zend\Db\Adapter\Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 D:\xampp\htdocs\magento\magento-orginal\lib\Zend\Db\Adapter\Pdo\Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `lo...', Array)
#4 D:\xampp\htdocs\magento\magento-orginal\lib\Varien\Db\Adapter\Pdo\Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `lo...', Array)
#5 D:\xampp\htdocs\magento\magento-orginal\lib\Zend\Db\Adapter\Abstract.php(576): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `lo...', Array)
#6 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Model\Resource\Db\Abstract.php(453): Zend_Db_Adapter_Abstract->insert('log_visitor', Array)
#7 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Model\Abstract.php(318): Mage_Core_Model_Resource_Db_Abstract->save(Object(Mage_Log_Model_Visitor))
#8 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Log\Model\Visitor.php(168): Mage_Core_Model_Abstract->save()
#9 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Model\App.php(1338): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#10 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Model\App.php(1317): Mage_Core_Model_App->_callObserverMethod(Object(Mage_Log_Model_Visitor), 'initByRequest', Object(Varien_Event_Observer))
#11 D:\xampp\htdocs\magento\magento-orginal\app\Mage.php(448): Mage_Core_Model_App->dispatchEvent('controller_acti...', Array)
#12 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Controller\Varien\Action.php(527): Mage::dispatchEvent('controller_acti...', Array)
#13 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Controller\Front\Action.php(64): Mage_Core_Controller_Varien_Action->preDispatch()
#14 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Controller\Varien\Action.php(407): Mage_Core_Controller_Front_Action->preDispatch()
#15 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#16 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Controller\Varien\Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#17 D:\xampp\htdocs\magento\magento-orginal\app\code\core\Mage\Core\Model\App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#18 D:\xampp\htdocs\magento\magento-orginal\app\Mage.php(684): Mage_Core_Model_App->run(Array)
#19 D:\xampp\htdocs\magento\magento-orginal\index.php(87): Mage::run('', 'store')
#20 {main}

Error log record number: 903861541
like image 206
bitcodr Avatar asked Dec 15 '22 16:12

bitcodr


1 Answers

There is problem in log_visitor table in your magento You can truncate following table this tables are can have lots data which aquire more space in server. Execute follwing commnds in your magento database :

TRUNCATE log_customer;
TRUNCATE log_quote;
TRUNCATE log_summary;
TRUNCATE log_summary_type;
TRUNCATE log_url;
TRUNCATE log_url_info;
TRUNCATE log_visitor;
TRUNCATE log_visitor_info;
TRUNCATE log_visitor_online;

After that refresh cache and cache storage and check in frontend.

like image 174
Shyam Ranpara Avatar answered Apr 28 '23 14:04

Shyam Ranpara