Skip to content

Conversation

@asittampalam
Copy link

@asittampalam asittampalam commented Oct 28, 2019

When a MariaDB with a VIEW was backupped, it couldn't be restored in the iAPC environment because the dump contained DEFINER=XXXXXXXX statements which needed SUPER PRIVILEGES during the restore process.

ERROR 1227 (42000) at line 941: Access denied; you need (at least one of) the SUPER privilege(s) for this operation```
sed -n 942p XXXX_mariadb_main_20191028030000 
/*!50013 DEFINER=`XXXXXXXXX`@`%` SQL SECURITY INVOKER */

This pull request removes those statements from the dump and thus fixes the restoring process.

@asittampalam
Copy link
Author

Any updates on this @JamesClonk ? :)

@JamesClonk
Copy link
Member

@asittampalam Sorry, I seem to have completely missed PR notifications for this repo. Didn't realize until now there was something waiting. Oops! 😅

Unfortunately this will not work by simply adding | sed, as it will produce incomplete dump files since the stream will get closed too early / not recognized when it actually closes. Dumps created via this PR would be broken. I just tested it on a small 2MB test database and the resulting dump was always incomplete unfortunately.

I'd also rather go for modifying the backup during restore while piping it into mysql rather than during dumping. You'd have to hook ontop the gzip reader and look for lines which contain DEFINER to be able to remove them before they're passed along to cmd.Stdin.

JamesClonk added a commit that referenced this pull request Jan 10, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants