Question

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

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?


Submit an answer
Answer a question...

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!

Sign In or Sign Up to Answer

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.

KFSys
Site Moderator
Site Moderator badge
May 11, 2022
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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

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…