Bug #62598 backup user cannot 'SHOW FIELDS FROM' views
Submitted: 2 Oct 2011 12:27 Modified: 13 Dec 2011 18:02
Reporter: Van Stokes Email Updates:
Status: No Feedback Impact on me:
None 
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:5.5.16 x86_64 OS:Linux (Ubuntu 11.04 x86_64)
Assigned to: CPU Architecture:Any
Tags: Backup, mysqldump

[2 Oct 2011 12:27] Van Stokes
Description:
Getting the following error while trying to backup a database with mysqldump using user 'backup' having 'read-only' privs. mysqldump execution stops and the database is NOT dumped.

This statement:
/usr/bin/mysqldump --host=localhost --user=backup --password=HiddenPassword --databases origin --result-file=Origin.sql --opt --compress

Yields the following output:
mysqldump: Couldn't execute 'SHOW FIELDS FROM `bookmark_view`': execute command denied to user 'backup'@'localhost' for routine 'origins.OwnerGetTypeByName' (1370)

For this user:
SHOW GRANTS FOR 'backup'@'localhost';
GRANT SELECT, SHOW DATABASES, LOCK TABLES, SHOW VIEW, EVENT ON *.* TO 'backup'@'localhost' IDENTIFIED BY PASSWORD 'xxx'

$ mysqld --version
mysqld  Ver 5.5.16-log for Linux on x86_64 (MySQL Community Server (GPL))

$ mysqldump --version
mysqldump  Ver 10.13 Distrib 5.5.16, for Linux (x86_64)

$ mysql --version
mysql  Ver 14.14 Distrib 5.5.16, for Linux (x86_64) using readline 5.1

How to repeat:
Attempt to backup a database having views and routines with the grants above.

Suggested fix:
Not sure. I think it's an internal permission error.
If I execute the mysqldump with a user having root like permissions I do NOT get the error.
[13 Nov 2011 18:02] Valeriy Kravchuk
Based on the error message:

mysqldump: Couldn't execute 'SHOW FIELDS FROM `bookmark_view`': execute command denied to
user 'backup'@'localhost' for routine 'origins.OwnerGetTypeByName' (1370)

your view is defined so that it refers to the stored function your backup user does not have privileges for. Please, check.
[14 Dec 2011 7:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".