12/10/2014

How to create mysql user on Amazon RDS


When I created a new mysql user on RDS, I got the following error.

===
ERROR 1184 (08S01): Aborted connection  to db: 'unconnected' user:  host:  (init_connect command failed)
===
After googling a while, the cause looks that I changed the timezone of the RDS from UTC to JST.

I got around the issue by the following commands. I need to grant execute command to mysql DB to a new mysql user.


mysql> grant execute on mysql.* to 'some_user'@'%';
mysql> grant select on some_db.some_table to 'some_user'@"%";
mysql> flush privileges;
mysql> set password for 'some_user'@'%' = password('some_pass');

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| some_db            |
| mysql              |
+--------------------+
3 rows in set (0.00 sec)
Now it works, :) even though I don't like the new mysql user to access information schema and mysql db.

1 comment:

Unknown said...

Hi,

Actually, this error occurs because user lacks permissions to call only 1 procedure:
CALL mysql.store_time_zone

The following helped me to get rid of error:
GRANT EXECUTE ON PROCEDURE mysql.store_time_zone TO 'USERNAME'@'%';

Thanks,
Pavel