# mysql\_user – create a user on a remote host from a inventory host

**URL:** <https://forum.ansible.com/t/mysql-user-create-a-user-on-a-remote-host-from-a-inventory-host/31210>\
**Category:** Ansible Project\
**Created:** [September 5, 2019, 3:10pm UTC](https://forum.ansible.com/t/mysql-user-create-a-user-on-a-remote-host-from-a-inventory-host/31210 "2019-09-05T15:10:06Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Serge\_Zajac](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@Serge\_Zajac](https://forum.ansible.com/u/Serge_Zajac)\
**Post date:** [September 5, 2019, 3:10pm UTC](https://forum.ansible.com/t/mysql-user-create-a-user-on-a-remote-host-from-a-inventory-host/31210/1 "2019-09-05T15:10:06Z")

</div>

Hi,

I have a simple question.  
mysql\_user module have some requirements,  
One of them is Requires the PyMySQL (Python 2.7 and Python 3.X) or MySQL-python (Python 2.X) package on the remote host.

We have installed requirements on a intermediate server named serverA  
Is it possible to use the module to create a user on some other servers through serverA

- name: Création d’un compte nominatif MySql  
hosts: serverA

tasks:

- name: “Create user on the remote host”  
mysql\_user:  
login\_host: serverB  
login\_port: “{{ portbddServerB }}”  
login\_user: admin  
login\_password: passadmin  
name: myuser  
password: passuser  
login\_unix\_socket: null  
register: resultat

It seems that the module tries to connect the database on serverA

fatal: [serverA]: FAILED! =\> {“changed”: false, “msg”: “unable to connect to database, check login\_user and login\_password are correct or /home/mysql/.my.cnf has the credentials. Exception message: (1045, "Access denied for user ‘\*\*\*’@‘serverA’ (using password: YES)")”}

thanks for your help.

---

<div class="post-metadata">

**Author:** ![Serge\_Zajac](https://avatars.discourse-cdn.com/v4/letter/s/d2c977/32.png) [@Serge\_Zajac](https://forum.ansible.com/u/Serge_Zajac)\
**Post date:** [September 5, 2019, 3:26pm UTC](https://forum.ansible.com/t/mysql-user-create-a-user-on-a-remote-host-from-a-inventory-host/31210/2 "2019-09-05T15:26:08Z")

</div>

it’s ok it works, that was simply a connexion problem. sorry
