Mysql – Connection to Amazon RDS MySQL instance fails with `init_connect command failed`

mariadbMySQL

I'm attempting to open a connection from my Amazon RDS instance to my local dev machine. I added my IP to the security policy in Amazon's panel (read: whitelisted myself in the firewall) and added my user in MySQL:

grant usage on bar.* to foo@0.0.0.0 identified by "foobar";
grant all privileges on bar.* to foo@0.0.0.0;

Assume that 0.0.0.0 is actually my IP.

I then attempt to connect via the command-line MySQL client:

[wk@batman ~]$ mysql –host=1.1.1.1 –user=foo -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MySQL connection id is 66287753
Server version: 5.6.17-log

Copyright (c) 2000, 2014, Oracle, SkySQL Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MySQL [(none)]> show databases;
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id:    66287829
Current database: *** NONE ***

ERROR 1184 (08S01): Aborted connection 66287829 to db: 'unconnected' user: 'foo' host: 0.0.0.0 (init_connect command failed)

I'm not sure what could be causing this error – the results I could find on Google pertained to database replication. Does anyone have any idea what's wrong?

Best Answer

This is because the user does not have execute grant global, to fix it

GRANT EXECUTE ON *.* TO user_name;