I updated the timezone on an AWS MySql instance, and tech support told me I also had to runt his command for each MySql user:
GRANT EXECUTE ON PyupROCEDURE `mysql`.`store_time_zone` TO 'some_user'@'localhost';
I tried running without selecting a database and got this error:
ERROR 1046 (3D000): No database selected
So then I ran:
use db2;
GRANT EXECUTE ON PyupROCEDURE `mysql`.`store_time_zone` TO 'some_user'@'localhpst';
And I got this error:
ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'ON PyupROCEDURE `mysql`.`store_time_zone` TO 'some_user'@'localhost'' at line 1
I looked at the docs (http://dev.mysql.com/doc/refman/5.6/en/grant.html) and I don't see what would be wrong – here I want to grant access to a procedure and that seems to correspond to the docs:
GRANT
priv_type [(column_list)]
[, priv_type [(column_list)]] ...
ON [object_type] priv_level
TO user_specification [, user_specification] ...
[REQUIRE {NONE | ssl_option [[AND] ssl_option] ...}]
[WITH {GRANT OPTION | resource_option} ...]
object_type: {
TABLE
| FUNCTION
| PROCEDURE
}
And also this is how we created the procedure:
DELIMITER |
CREATE PROCEDURE mysql.store_time_zone ()
IF NOT (POSITION('rdsadmin@' IN CURRENT_USER()) = 1) THEN
SET SESSION time_zone = 'America/New_York';
END IF |
DELIMITER ;
Where did I go wrong? Thanks for any suggestions.
Best Answer
It is impossible to run this command:
Here is why:
Here is how you can prove it:
User grants for MySQL exist in four(4) MyISAM tables
mysql.user
(Global grants)mysql.db
(Database level grants)mysql.tables_priv
(Table level grants)mysql.columns_priv
(Column level grants)If you run this query
Only
mysql.user
andmysql.db
have columns in themysql
schema representing the EXECUTE privilege.Therefore, these commands would work