Search code examples
mysqlamazon-emr

Using MySQL instance on AWS EMR cluster


I created an AWS EMR instance and logged in "Master" console via putty. I'm able to get in to MySQL command line on the console. I login as "hadoop@localhost"

mysql> SELECT user();
+------------------+
| user()           |
+------------------+
| hadoop@localhost |
+------------------+

Now I want to create some users and databases for other projects. When I try to create a new user on MYSQL I get the below error.

How can I create user on EMR-MySQL instance, and give them permission ?

mysql> CREATE USER 'dbadmin'@'localhost' IDENTIFIED BY 'dbadmin';
ERROR 1227 (42000): Access denied; you need (at least one of) the CREATE USER privilege(s) for this operation

BTW when I login to MySQL console, it automatically logs me in as "hadoop@localhost", as that is the user I used to login to machine via putty.

Please advise. Thanks.


Solution

  • Hive uses MySQL for its metadata store on EMR. You will need to stop the MySQL service, restart in safe mode and do a standard root password recovery. This will give you root access. However, STOP and don't do this. Create your MySQL database somewhere else.