Report this

What is the reason for this report?

"ERROR 1227 (42000) at line x: Access denied" when using doadmin user

Posted on May 11, 2022

I made a dump of a MySQL DB with mysqldump and am now trying to restore it to my DigitalOcean managed DB using the doadmin user and I get this error:

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

Line 18 of the SQL dump is this:

SET @@SESSION.SQL_LOG_BIN= 0;

I comment that line out by prepending # to that and then got an error on these lines:

SET @@GLOBAL.GTID_PURGED=/*!80000 '+'*/ '060bc47a-c804-11ec-a3fa-b269afb00e36:1-4029';
SET @@SESSION.SQL_LOG_BIN = @MYSQLDUMP_TEMP_LOG_BIN;

Manually commenting out the lines is fine for MySQL dumps that are a few MB big but it’s a lot trickier with a multi GB DB dump.

Any ideas?



This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
0

Accepted Answer

Hi @jimwigginton,

the command you’ve used:

  1. sed 's/SET @@SESSION.SQL_LOG_BIN.*//' -i backup.sql
  2. sed 's/SET @@GLOBAL.GTID_PURGED.*//' -i backup.sql

I’m glad it has helped you. Having said that, yes the doadmin user on the Managed platform does not have permissions like a root user. This is because the product is managed at it has limitations. Imagine every person having root access to the Managed Database.

I was somewhat able to get around this by doing this:

sed 's/SET @@SESSION.SQL_LOG_BIN.*//' -i backup.sql
sed 's/SET @@GLOBAL.GTID_PURGED.*//' -i backup.sql

I still think it’s weird that the default doadmin user doesn’t have the maximum possible permissions…

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Get started for free

Sign up and get $200 in credit for your first 60 days with DigitalOcean.*

*This promotional offer applies to new accounts only.