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


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.

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…

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Become a contributor for community

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

DigitalOcean Documentation

Full documentation for every DigitalOcean product.

Resources for startups and SMBs

The Wave has everything you need to know about building a business, from raising funding to marketing your product.

Get our newsletter

Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.

New accounts only. By submitting your email you agree to our Privacy Policy

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.