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.
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)"}
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.