尝试将媒体存储同步到数据库时Magento SQLSTATE [42000]错误

时间:2014-12-30 05:44:14

标签: mysql magento magento-1.9

在magento中,我已将媒体存储设置从文件系统更改为数据库,然后单击“同步”。它没有成功,我收到以下错误消息:

  

同步媒体存储时发生错误。在媒体存储同步过程中,一个或多个媒体文件无法同步。


以下是exception.log文件结果:

2014-12-30T05:18:35+00:00 ERR (3):
exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC or     ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.' in /home/example/public_html/dev/lib/Varien/Db/Statement/Pdo/Mysql.php:82
Stack trace:
#0 /home/example/public_html/dev/lib/Varien/Db/Statement/Pdo/Mysql.php(82): PDOStatement->execute()
#1 /home/example/public_html/dev/lib/Varien/Db/Statement/Pdo/Mysql.php(108): Varien_Db_Statement_Pdo_Mysql->_executeWithBinding(Array)
#2 /home/example/public_html/dev/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#3 /home/example/public_html/dev/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#4 /home/example/public_html/dev/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `co...', Array)
#5 /home/example/public_html/dev/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `co...', Array)
#6 /home/example/public_html/dev/lib/Varien/Db/Adapter/Pdo/Mysql.php(1934): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `co...', Array)
#7 /home/example/public_html/dev/app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php(206): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('core_file_stora...', Array, Array)
#8 /home/example/public_html/dev/app/code/core/Mage/Core/Model/File/Storage/Database.php(213): Mage_Core_Model_Resource_File_Storage_Database->saveFile(Array)
#9 /home/example/public_html/dev/app/code/core/Mage/Core/Model/File/Storage.php(205): Mage_Core_Model_File_Storage_Database->importFiles(Array)
#10 /home/example/public_html/dev/app/code/core/Mage/Adminhtml/controllers/System/Config/System/StorageController.php(86): Mage_Core_Model_File_Storage->synchronize(Array)
#11 /home/example/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_System_Config_System_StorageController->synchronizeAction()
#12 /home/example/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('synchronize')
#13 /home/example/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#14 /home/example/public_html/dev/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#15 /home/example/public_html/dev/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#16 /home/example/public_html/dev/index.php(87): Mage::run('', 'store')
#17 {main}

Next exception 'Zend_Db_Statement_Exception' with message 'SQLSTATE[42000]: Syntax error or access violation: 1118 Row size too large (> 8126). Changing some columns to TEXT or BLOB or using ROW_FORMAT=DYNAMIC     or ROW_FORMAT=COMPRESSED may help. In current row format, BLOB prefix of 768 bytes is stored inline.' in /home/example/public_html/dev/lib/Varien/Db/Statement/Pdo/Mysql.php:84
Stack trace:
#0 /home/example/public_html/dev/lib/Varien/Db/Statement/Pdo/Mysql.php(108): Varien_Db_Statement_Pdo_Mysql->_executeWithBinding(Array)
#1 /home/example/public_html/dev/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /home/example/public_html/dev/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /home/example/public_html/dev/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('INSERT INTO `co...', Array)
#4 /home/example/public_html/dev/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('INSERT INTO `co...', Array)
#5 /home/example/public_html/dev/lib/Varien/Db/Adapter/Pdo/Mysql.php(1934): Varien_Db_Adapter_Pdo_Mysql->query('INSERT INTO `co...', Array)
#6 /home/example/public_html/dev/app/code/core/Mage/Core/Model/Resource/File/Storage/Database.php(206): Varien_Db_Adapter_Pdo_Mysql->insertOnDuplicate('core_file_stora...', Array, Array)
#7 /home/example/public_html/dev/app/code/core/Mage/Core/Model/File/Storage/Database.php(213): Mage_Core_Model_Resource_File_Storage_Database->saveFile(Array)
#8 /home/example/public_html/dev/app/code/core/Mage/Core/Model/File/Storage.php(205): Mage_Core_Model_File_Storage_Database->importFiles(Array)
#9 /home/example/public_html/dev/app/code/core/Mage/Adminhtml/controllers/System/Config/System/StorageController.php(86): Mage_Core_Model_File_Storage->synchronize(Array)
#10 /home/example/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Adminhtml_System_Config_System_StorageController->synchronizeAction()
#11 /home/example/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('synchronize')
#12 /home/example/public_html/dev/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#13 /home/example/public_html/dev/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#14 /home/example/public_html/dev/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#15 /home/example/public_html/dev/index.php(87): Mage::run('', 'store')
#16 {main}


她是我的MYSQL my.cnf文件:

[mysqld]
innodb_file_per_table=1
local-infile=0
open_files_limit=3334
max_allowed_packet=268435456
innodb_buffer_pool_size=134217728

# Custom
query_cache_type = 1
query_cache_size = 64M
query_cache_limit = 2M
thread_cache_size = 32
join_buffer_size = 8M
tmp_table_size = 256M
key_buffer = 32M
innodb_autoextend_increment = 512
max_heap_table_size = 256M
read_buffer_size = 2M
read_rnd_buffer_size = 16M
bulk_insert_buffer_size = 64M
myisam_sort_buffer_size = 128M
myisam_max_sort_file_size = 10G
myisam_repair_threads = 1


虽然试图解决这个问题,但我读到它可能是因为magento中设置了大量属性,但我只有64个,并且其中没有多少被设置为“用于产品列表中”#39;

我无法停用平板目录产品'因为我将在这家商店拥有超过30,000多种产品。

我还检查过媒体文件夹是否可写。

1 个答案:

答案 0 :(得分:1)

看起来很明显发生了什么。介质数据库中的列类型不支持您要插入的字符串大小。但是,不确定此问题是由文件名长度还是图像大小引起的。

图片大小:

将媒体作为数据库行插入时,图像将被编码为字符串。然后将这些字符串输入数据库列。图像越大,字符串将变得越长,因为将存储每个像素信息。所以你可能使用太大的图像。您获得的SQL错误为您的问题提供了解决方案,将数据库中的列类型更改为BLOB。手动执行此操作可能会解决您的问题,但可能与magento up-down或降级不兼容。

经过一些谷歌搜索后,似乎列“内容”是blob,所以这不应该是问题。

文件名大小:

可能还有一个存储文件名的字段,如果此列有长度限制,您也会收到此错误。大多数这样的列长度为255。请确认没有图像插入到数据库中且文件名太长。