共计 2366 个字符,预计需要花费 6 分钟才能阅读完成。
重启服务器后或重启mysql后有时候会发现,magento做的网站打开时出现数据库表损坏的错误提示,如:
SQLSTATE[HY000]: General error: 145 Table ‘./abc /log_visitor’ is marked as crashed and should be repaired
Trace:
#0 /shares/websites/xxxxxxx.com/lib/Zend/Db/Statement.php(283): Zend_Db_Statement_Pdo->_execute(Array)
#1 /shares/websites/www.domain.com/lib/Zend/Db/Adapter/Abstract.php(406): Zend_Db_Statement->execute(Array)
#2 /shares/websites/www.domain.com/lib/Zend/Db/Adapter/Pdo/Abstract.php(206): Zend_Db_Adapter_Abstract->query(’INSERT INTO `lo…’, Array)
#3 /shares/websites/www.domain.com/lib/Zend/Db/Adapter/Abstract.php(484): Zend_Db_Adapter_Pdo_Abstract->query(’INSERT INTO `lo…’, Array)
#4 /shares/websites/www.domain.com/app/code/core/Mage/Core/Model/Mysql4/Abstract.php(343): Zend_Db_Adapter_Abstract->insert(’log_visitor’, Array)
#5 /shares/websites/www.domain.com/app/code/core/Mage/Core/Model/Abstract.php(235): Mage_Core_Model_Mysql4_Abstract->save(Object(Mage_Log_Model_Visitor))
#6 /shares/websites/www.domain.com/app/code/core/Mage/Log/Model/Visitor.php(136): Mage_Core_Model_Abstract->save()
#7 /shares/websites/www.domain.com/app/code/core/Mage/Core/Model/App.php(1032): Mage_Log_Model_Visitor->initByRequest(Object(Varien_Event_Observer))
#8 /shares/websites/www.domain.com/app/Mage.php(278): Mage_Core_Model_App->dispatchEvent(’controller_acti…’, Array)
#9 /shares/websites/www.domain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(377): Mage::dispatchEvent(’controller_acti…’, Array)
#10 /shares/websites/www.domain.com/app/code/core/Mage/Core/Controller/Front/Action.php(40): Mage_Core_Controller_Varien_Action->preDispatch()
#11 /shares/websites/www.domain.com/app/code/core/Mage/Core/Controller/Varien/Action.php(335): Mage_Core_Controller_Front_Action->preDispatch()
#12 /shares/websites/www.domain.com/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(159): Mage_Core_Controller_Varien_Action->dispatch(’index’)
#13 /shares/websites/www.domain.com/app/code/core/Mage/Core/Controller/Varien/Front.php(146): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 /shares/websites/www.domain.com/app/Mage.php(427): Mage_Core_Controller_Varien_Front->dispatch()
#15 /shares/websites/www.domain.com/index.php(40): Mage::run(’default’)
#16 {main}
进入mysql数据库的数据目录,通常是/var/lib/mysql
到mysql console执行下面的命令修复mysql被破环的表
myisamchk -r *.myi
(myisamchk文件在MySQL\bin中)
即可修复好magento数据库中由于mysql服务器重启破坏的表结构.