on Chapter3, Page 36: unable to connect to database, check login_user and login_password

Author: kaygdotorgCreated Mar 17, 2024Updated Aug 29, 2025

On page 36 of the book, the command fails with the following error message. I am thinking mysql needs some more configuration before access is allowed?

$ ansible db -b -m mysql_user -a "name=django host=% password=12345 priv=*:*:ALL host=localhost state=present"
[WARNING]: Found both group and host with same name: db
db | FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python3"
    },
    "changed": false,
    "msg": "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials. Exception message: (1698, \"Access denied for user 'root'@'localhost'\")"
}

Source: geerlingguy/ansible-for-devops