# Error when using mysql\_db to assign privileges in MySQL on RDS.

**URL:** <https://forum.ansible.com/t/error-when-using-mysql-db-to-assign-privileges-in-mysql-on-rds/21557>\
**Category:** Ansible Project\
**Created:** [May 25, 2016, 12:23am UTC](https://forum.ansible.com/t/error-when-using-mysql-db-to-assign-privileges-in-mysql-on-rds/21557 "2016-05-25T00:23:50Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Daniel\_McQuillen](https://avatars.discourse-cdn.com/v4/letter/d/3da27b/32.png) [@Daniel\_McQuillen](https://forum.ansible.com/u/Daniel_McQuillen)\
**Post date:** [May 25, 2016, 12:23am UTC](https://forum.ansible.com/t/error-when-using-mysql-db-to-assign-privileges-in-mysql-on-rds/21557/1 "2016-05-25T00:23:50Z")

</div>

Hi all,

I’ve been working with Ansible as I try to set up a specific configuration for Open EdX (the open source MOOC) to work with MySQL hosted by Amazon’s RDS service.

At one point in the Open EdX ansible plays, it tries to create an “admin” user and assign “CREATE USER” privileges to it

```auto
mysql_user:
  name: "admin"
  password: "some password for admin user"
  priv: "*.*:CREATE USER"
  login_host: "some RDS Mysql host url"
  login_user: "some root user"
  login_password: "some root password"

```

However, when this play runs, Ansible fails with the following message:

> failed: [localhost] =\> {“failed”: true}
> 
> msg: (1045, “Access denied for user ‘root’@‘%’ (using password: YES)”)
> 
> FATAL: all hosts have already failed – aborting

I then read that when using Ansible with RDS, you can’t use the _._ selection mechanism, but rather have to use %.\* … and I’ve used that successfully in another part of the Ansible script to assign ALL privileges.

But when I update this play to have priv: “%.\*:CREATE USER” I then get the error

> failed: [localhost] =\> {“failed”: true}
> 
> msg: (1221, ‘Incorrect usage of DB GRANT and GLOBAL PRIVILEGES’)
> 
> FATAL: all hosts have already failed – aborting

Any thoughts on assigning CREATE USER privileges to a user in RDS via Ansible?

Thanks.

Daniel

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 25, 2016, 3:29pm UTC](https://forum.ansible.com/t/error-when-using-mysql-db-to-assign-privileges-in-mysql-on-rds/21557/2 "2016-05-25T15:29:31Z")

</div>

This looks like your user root does not have the needed privileges to  
grant privileges to other users.

Does this step work, if you do it manually?

Johannes
