4

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?

2
  • I think your database user has no permission to create table. recheck this and try again Commented Jul 28, 2018 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. Commented Jul 28, 2018 at 13:46

1 Answer 1

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 and acknowledge you have read our privacy policy.

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