# mysql\_user module and LOCK TABLES

**URL:** <https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596>\
**Category:** Ansible Project\
**Created:** [October 2, 2013, 8:49pm UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596 "2013-10-02T20:49:55Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jonathan\_Rowlands](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@Jonathan\_Rowlands](https://forum.ansible.com/u/Jonathan_Rowlands)\
**Post date:** [October 2, 2013, 8:49pm UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596/1 "2013-10-02T20:49:55Z")

</div>

I am trying to run the following:

- name: gitlab | mysql | ensure database user gitlab has necessary privleges  
mysql\_user: state=present name=gitlab priv=gitlabhq\_production.\*:SELECT,LOCK TABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER

The “LOCK TABLES” priv is a problem though since it has a space. Is there any way around this?

---

<div class="post-metadata">

**Author:** ![Jonathan\_Rowlands](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@Jonathan\_Rowlands](https://forum.ansible.com/u/Jonathan_Rowlands)\
**Post date:** [October 2, 2013, 8:57pm UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596/2 "2013-10-02T20:57:33Z")

</div>

```auto
TASK: [gitlab | mysql | ensure database user gitlab has necessary privileges] *** 
failed: [192.168.0.13] => {"failed": true, "item": ""}
msg: this module requires key=value arguments (['state=present', 'name=gitlab', 'priv=gitlabhq_production.*:SELECT,LOCK', 'TABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER'])

```

---

<div class="post-metadata">

**Author:** ![James\_Cammarata1](https://avatars.discourse-cdn.com/v4/letter/j/d26b3c/32.png) [@James\_Cammarata1](https://forum.ansible.com/u/James_Cammarata1)\
**Post date:** [October 2, 2013, 9:00pm UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596/3 "2013-10-02T21:00:21Z")

</div>

Escape the space: “LOCK\ TABLES”. The parsing is done by the python shlex module if I remember right, so this should get you past the issue.

---

<div class="post-metadata">

**Author:** ![Jonathan\_Rowlands](https://avatars.discourse-cdn.com/v4/letter/j/22d042/32.png) [@Jonathan\_Rowlands](https://forum.ansible.com/u/Jonathan_Rowlands)\
**Post date:** [October 2, 2013, 9:04pm UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596/4 "2013-10-02T21:04:45Z")

</div>

Doh, I should have known. Thanks that worked.

---

<div class="post-metadata">

**Author:** ![Michael\_DeHaan2](https://avatars.discourse-cdn.com/v4/letter/m/da6949/32.png) [@Michael\_DeHaan2](https://forum.ansible.com/u/Michael_DeHaan2)\
**Post date:** [October 2, 2013, 9:51pm UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596/5 "2013-10-02T21:51:31Z")

</div>

An easier way do to this would be to just quote the entire string.

shlex understands quotes and is pretty smart.

priv=“gitlabhq\_production.\*:SELECT,LOCK TABLES,INSERT,UPDATE,DELETE,CREATE,DROP,INDEX,ALTER”

---

<div class="post-metadata">

**Author:** ![prateek\_gupta](https://avatars.discourse-cdn.com/v4/letter/p/f17d59/32.png) [@prateek\_gupta](https://forum.ansible.com/u/prateek_gupta)\
**Post date:** [April 15, 2014, 10:53am UTC](https://forum.ansible.com/t/mysql-user-module-and-lock-tables/13596/6 "2014-04-15T10:53:37Z")

</div>

Can you please cross check this  
Im trying to create a user but it gets executed but the user is not getting created in my RDS mysql DB .
