# Problems running mysql\_user

**URL:** <https://forum.ansible.com/t/problems-running-mysql-user/17237>\
**Category:** Ansible Project\
**Created:** [January 11, 2015, 5:27am UTC](https://forum.ansible.com/t/problems-running-mysql-user/17237 "2015-01-11T05:27:36Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dirk\_Roder](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dirk\_Roder](https://forum.ansible.com/u/Dirk_Roder)\
**Post date:** [January 11, 2015, 5:27am UTC](https://forum.ansible.com/t/problems-running-mysql-user/17237/1 "2015-01-11T05:27:36Z")

</div>

Hello together,  
I do have a problem with the mysql\_user module.  
It does create my user with the provided password, but it does not create the permissions I do pass.

Here is my call:

`

- name: Create User with single database privilieges  
mysql\_user: name=“ttr”  
host=localhost  
password=testPass  
priv=“tinytinyrss.\*:USAGE”  
state=present

`

When I then log into MySQL and view allowed databases:

`  
[root@munin ~]# mysql -u ttr -ptestPass  
Enter password:  
Welcome to the MariaDB monitor. Commands end with ; or \g.  
Your MariaDB connection id is 60  
Server version: 5.5.40-MariaDB MariaDB Server

Copyright (c) 2000, 2014, Oracle, Monty Program Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [(none)]\> SHOW DATABASES;

---

<div class="post-metadata">

**Author:** ![Tom\_Bamford](https://avatars.discourse-cdn.com/v4/letter/t/c2a13f/32.png) [@Tom\_Bamford](https://forum.ansible.com/u/Tom_Bamford)\
**Post date:** [January 12, 2015, 5:47am UTC](https://forum.ansible.com/t/problems-running-mysql-user/17237/2 "2015-01-12T05:47:42Z")

</div>

Hi Dirk

Would you not need to grant SELECT instead of USAGE?

According to MySQL docs, USAGE is granted at the server level. When I create a user locally (with or without Ansible), that user gets USAGE on _._ but it doesn’t allow them to see any databases.

Regards

Tom

---

<div class="post-metadata">

**Author:** ![Dirk\_Roder](https://avatars.discourse-cdn.com/v4/letter/d/e8c25b/32.png) [@Dirk\_Roder](https://forum.ansible.com/u/Dirk_Roder)\
**Post date:** [January 12, 2015, 6:57pm UTC](https://forum.ansible.com/t/problems-running-mysql-user/17237/3 "2015-01-12T18:57:13Z")

</div>

Hi Tom,  
I worked around it meanwhile with the following:

`

- name: Create TinyTinyRSS database user  
when: ttr.stat.exists == False  
mysql\_user: name={{ app\_dbUser }}  
host=localhost  
password=“{{ mysql\_user\_pass.stdout }}”  
priv=“{{ app\_dbName }}.\*:SELECT,INSERT,UPDATE,DELETE”  
state=present

`

```auto

# Revoke all privileges for user 'bob' and password '12345' 
- mysql_user: name=bob password=12345 priv=*.*:USAGE state=present

The MySQL Documentation explains it with the full details:

```

> The [`USAGE`](http://dev.mysql.com/doc/refman/5.1/en/privileges-provided.html#priv_usage) privilege specifier stands for “no privileges.” It is used at the global level with [`GRANT`](http://dev.mysql.com/doc/refman/5.1/en/grant.html) to modify account attributes such as resource limits or SSL characteristics without affecting existing account privileges.

```auto

```

So it was a mistake of mine, not ansible. Shame on me 😕  
Nevetheless thanks for the hint.

Kind regards  
Dirk
