# mysql\_user priv problem

**URL:** <https://forum.ansible.com/t/mysql-user-priv-problem/14916>\
**Category:** Ansible Project\
**Created:** [April 2, 2014, 11:09am UTC](https://forum.ansible.com/t/mysql-user-priv-problem/14916 "2014-04-02T11:09:32Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Marko\_Lisica](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marko\_Lisica](https://forum.ansible.com/u/Marko_Lisica)\
**Post date:** [April 2, 2014, 11:09am UTC](https://forum.ansible.com/t/mysql-user-priv-problem/14916/1 "2014-04-02T11:09:32Z")

</div>

Hello,

I have a task that reads user and db and grants permisions on specific db for specific user.

[https://gist.github.com/markotitel/9931850](https://gist.github.com/markotitel/9931850)

Problem is that only last DB from list is granted for specific user.

I have same task with same vars for folder creation and it works fine.

[https://gist.github.com/markotitel/9931867](https://gist.github.com/markotitel/9931867)

What am I doing wrong?

---

<div class="post-metadata">

**Author:** ![Marko\_Lisica](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marko\_Lisica](https://forum.ansible.com/u/Marko_Lisica)\
**Post date:** [April 2, 2014, 11:22am UTC](https://forum.ansible.com/t/mysql-user-priv-problem/14916/2 "2014-04-02T11:22:15Z")

</div>

UPDATE:

Here is debug msg from mysql task that looks fine, so I guess something about mysql\_user module may be odd.

---

<div class="post-metadata">

**Author:** ![Marko\_Lisica](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marko\_Lisica](https://forum.ansible.com/u/Marko_Lisica)\
**Post date:** [April 2, 2014, 12:41pm UTC](https://forum.ansible.com/t/mysql-user-priv-problem/14916/3 "2014-04-02T12:41:36Z")

</div>

I am sorry for spamming like this but just got into my mind to try something:

- name: grant privileges on databases  
raw: mysql -e “grant all privileges on {{ item.1 }}.\* to {{ item.0.user}}@localhost”  
with\_subelements:
- users
- db  
this task works as expected, and I beleive this might be a bug in mysql\_user module.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan1](https://avatars.discourse-cdn.com/v4/letter/m/5e9695/32.png) [@Michael\_DeHaan1](https://forum.ansible.com/u/Michael_DeHaan1)\
**Post date:** [April 2, 2014, 3:47pm UTC](https://forum.ansible.com/t/mysql-user-priv-problem/14916/4 "2014-04-02T15:47:27Z")

</div>

Yep, probably is.

I think you filed a ticket on this earlier today, so we’re good to go.

(If you’d like to attempt a fix or further debugging, that would be welcome too!)

---

<div class="post-metadata">

**Author:** ![Marko\_Lisica](https://avatars.discourse-cdn.com/v4/letter/m/a5b964/32.png) [@Marko\_Lisica](https://forum.ansible.com/u/Marko_Lisica)\
**Post date:** [April 2, 2014, 9:28pm UTC](https://forum.ansible.com/t/mysql-user-priv-problem/14916/5 "2014-04-02T21:28:37Z")

</div>

Hi,

I would gladly fix it but dont know programming much, I am ultimate noobster.
