How to fix database privilege issues for a Craft CMS on Fortrabbit

Oscar de la Hera Gomez
A flower that represents Fortrabbit, next to one that represents Craft CMS. Beneath it its the text "Fix Error 1227 Access Denied".

To fix the ERROR 1227 Access Denied issue create a .my.cnf file and apply the following code. Subsequently, export a database once to fix the problem forever.

When attempting to replace our database on a hosted CraftCMS we kept running into the following error, regardless of how we tried to import a database.

$exit code 1: ERROR 1227 (42000) at line 18: Access denied; you need (at least one of) the SUPER, SYSTEM_VARIABLES_ADMIN or SESSION_VARIABLES_ADMIN privilege(s) for this operation at /srv/app/craft3-xs7n/htdocs/vendor/craftcms/cms/src/db/Connection.php:502)"}

A screenshot of VSCode with the code for the .my.cnf provided by Fortrabbit.

After consulting Fortrabbit Support, they suggested that we create a .my.cnf file in the root directory and to paste in the code below.

They told us we needed to export a database before being able to import one, to make sure that the command was run. This fixed the issue.

Please note that we exported a DB using remote-sync and it also worked.

Any Questions ?

We are actively looking for feedback on how to improve this resource. Please send us a note to inquiries@delasign.com with any thoughts or feedback you may have.

delasign logo

Book a Free Consultation.

An icon of an email.

Click here to email us.

Fill in the details below to book a free consultation or to let us know about something else. Whatever it is, we are here to help.

How can we help you ?

Contact Details