1

I just cloned an existing droplet with a working instance of Craft, I created a MySQL8 managed DB but whenever I run php ./craft setup I get this error:

Caused by: Exception 'yii\db\Exception' with message 'SQLSTATE[HY000]: General error: 3161 Storage engine MyISAM is disabled (Table creation is disallowed).
The SQL being executed was: CREATE TABLE `searchindex` (
    `elementId` int(11) NOT NULL,
    `attribute` varchar(25) NOT NULL,
    `fieldId` int(11) NOT NULL,
    `siteId` int(11) NOT NULL,
    `keywords` text NOT NULL
)  ENGINE=MyISAM DEFAULT CHARACTER SET = utf8'

in /srv/gentri/vendor/yiisoft/yii2/db/Schema.php:678

Error Info:
Array
(
    [0] => HY000
    [1] => 3161
    [2] => Storage engine MyISAM is disabled (Table creation is disallowed).
)

Caused by: Exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 3161 Storage engine MyISAM is disabled (Table creation is disallowed).'

I understand that MyISAM is not as widely supported as InnoDB but that searchindex requires it because it is full text searchable. But I'm wondering how I can set Craft up with this restriction? If I run show engines in the database I can see that the DB is configured the exact same way as another Craft instance which is working perfectly fine. I'm also wondering why I've never run into this before when working with DigitalOcean's managed dbs.

1 Answer 1

2

If you're trying to install Craft directly onto a MySQL box that has MyISAM disabled, you can either:

  1. Modify Craft's install migration at vendor/craftcms/cms/src/migrations/Install.php

Find this:

// Add the FULLTEXT index on searchindex.keywords
$this->createTable(Table::SEARCHINDEX, [
    'elementId' => $this->integer()->notNull(),
    'attribute' => $this->string(25)->notNull(),
    'fieldId' => $this->integer()->notNull(),
    'siteId' => $this->integer()->notNull(),
    'keywords' => $this->text()->notNull(),
], ' ENGINE=MyISAM');

Change it to this:

// Add the FULLTEXT index on searchindex.keywords
$this->createTable(Table::SEARCHINDEX, [
    'elementId' => $this->integer()->notNull(),
    'attribute' => $this->string(25)->notNull(),
    'fieldId' => $this->integer()->notNull(),
    'siteId' => $this->integer()->notNull(),
    'keywords' => $this->text()->notNull(),
]);

Then do the installation, or:

  1. Do the Craft installation on a local dev environment that supports MyISAM, convert the searchindex table to InnoDB using your favorite MySQL client, then restore that database to the box that doesn't support MyISAM.

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.