I created a MySQL user via Ansible:
- name: MySQL user has ALL THE PRIVILEGES (in order to connect remotely)
mysql_user: name="{{ database_user }}" password="{{ database_password }}" priv="*.*:ALL,GRANT" host="%" state=present
notify: restart MySQL
- name: restart MySQL
service: name=mysql state=restarted
The user is created, and I am able to connect from localhost
, but not from any other machines.
Interestingly, running:
mysql> GRANT ALL PRIVILEGES ON *.* TO '{{ username }}'@'%' WITH GRANT OPTION;
as the root
MySQL user then allows those connections from any other machine.
I've reproduced this on a couple of Ubuntu 14.04 hosts with Ansible 1.9.4 installed via brew
running on Mac OS 10.11.
How do I correctly specify mysql_user
to enable connections from any host?