3

When installing Magento 2 (with `magento setup:install), I receive the following error:

...
[Progress: 16 / 557]
Module 'Magento_Catalog':
Installing schema... 

  [Zend_Db_Statement_Exception]                                                                                                                                                                  
  SQLSTATE[HY000]: General error: 3161 Storage engine MEMORY is disabled (Table creation is disallowed)., query was: CREATE TABLE IF NOT EXISTS `catalog_product_index_price_cfg_opt_agr_tmp` (  
    `parent_id` int UNSIGNED NOT NULL COMMENT 'Parent ID' ,                                                                                                                                      
    `child_id` int UNSIGNED NOT NULL COMMENT 'Child ID' ,                                                                                                                                        
    `customer_group_id` smallint UNSIGNED NOT NULL COMMENT 'Customer Group ID' ,                                                                                                                 
    `website_id` smallint UNSIGNED NOT NULL COMMENT 'Website ID' ,                                                                                                                               
    `price` decimal(12,4) NULL COMMENT 'Price' ,                                                                                                                                                 
    `tier_price` decimal(12,4) NULL COMMENT 'Tier Price' ,                                                                                                                                       
    PRIMARY KEY (`parent_id`, `child_id`, `customer_group_id`, `website_id`)                                                                                                                     
  ) COMMENT='Catalog Product Price Indexer Config Option Aggregate Temp Table' ENGINE=MEMORY charset=utf8 COLLATE=utf8_general_ci                                                                



  [PDOException]                                                                                          
  SQLSTATE[HY000]: General error: 3161 Storage engine MEMORY is disabled (Table creation is disallowed).

This appears to be because Alibaba Cloud has the MEMORY MySQL storage engine disabled.

Is there any way to set all table creations to use InnoDB?

  • I think your database user has no permission to create table. recheck this and try again – Murtuza Zabuawala Jul 28 '18 at 5:21
  • @MurtuzaZabuawala I'm using the root user and other tables created with InnoDB are created successfully. Only the tables with memory engine fail to create. – JeremyPlease Jul 28 '18 at 13:46
1

In the Magento 2 source code there are multiple files that use ENGINE_MEMORY. In order to work around this I had to ensure that tables are created with the InnoDB engine.

The simplest way to do this was to replace all occurrences of \Magento\Framework\DB\Adapter\Pdo\Mysql::ENGINE_MEMORY with 'INNODB'. This can be achieved with the following find and sed command:

find vendor/magento/ -name '*.php' -exec \
sed -i 's|\\Magento\\Framework\\DB\\Adapter\\Pdo\\Mysql::ENGINE_MEMORY|'\''INNODB'\''|g' {} \;

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.