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

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.

Oscar de la Hera Gomez
Written by Oscar de la Hera Gomez
First published on 09/13/2022 at 10:42
Last Updated on 09/13/2022 at 11:21
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.

SubscribeInquireView All PostsView All ServicesView All Work

Partner with us

We would love to get to know you and see how we can help your organization with its goals and needs.
Let's Talk

Stay Informed

Get occasional updates about our company, research, and product launches.
Subscribe