# The best way to change MySQL root password without copying a file text

**URL:** <https://forum.ansible.com/t/the-best-way-to-change-mysql-root-password-without-copying-a-file-text/24464>\
**Category:** Ansible Project\
**Created:** [May 11, 2017, 3:41pm UTC](https://forum.ansible.com/t/the-best-way-to-change-mysql-root-password-without-copying-a-file-text/24464 "2017-05-11T15:41:52Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tadeu\_Bernacchi](https://avatars.discourse-cdn.com/v4/letter/t/5f8ce5/32.png) [@Tadeu\_Bernacchi](https://forum.ansible.com/u/Tadeu_Bernacchi)\
**Post date:** [May 11, 2017, 3:41pm UTC](https://forum.ansible.com/t/the-best-way-to-change-mysql-root-password-without-copying-a-file-text/24464/1 "2017-05-11T15:41:52Z")

</div>

Hello guys,

I’m new at Ansible and i was playing around with it and i was setting a galera-cluster with MariaDB, everything went well, but when i tried to set mysql\_secure\_installation using my playbook with Ansible i had to send a copy a file (/root/my.cnf) to my node (root/.my.cnf) with my user and password on it.

I thought this approach was not very security, is there any other way to do this? I mean…it’s a fresh install and i dont have a root password yeat, i’m trying to do everything with ansible.

Any help will be appreciate!

Tks!!

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 12, 2017, 1:44am UTC](https://forum.ansible.com/t/the-best-way-to-change-mysql-root-password-without-copying-a-file-text/24464/2 "2017-05-12T01:44:48Z")

</div>

You can keep either the file or the secrets encrypted with  
ansible-vault until the time of transfer.
