geerlingguy / ansible-role-mysql

Ansible Role - MySQL
https://galaxy.ansible.com/geerlingguy/mysql/
MIT License
1.05k stars 861 forks source link

secure-installation fails on RHEL8 at remove test database. #522

Closed bufanda closed 10 months ago

bufanda commented 1 year ago

The step to remove the test database during secure installations fails on a host that already is running for serveral month and the playbook was used to provision the host. subsequents runs now fail at this step with an Access denied.

Ansible Controller: Red Hat Enterprise Linux 7.9 Ansible Core installation via package manager

Target Host Red Hat Enterprise linux 8.7

Playbook sets become to true.

The full Traceback

The full traceback is:
  File "/tmp/ansible_mysql_db_payload_034z8ww0/ansible_mysql_db_payload.zip/ansible/modules/database/mysql/mysql_db.py", line 383, in main
  File "/tmp/ansible_mysql_db_payload_034z8ww0/ansible_mysql_db_payload.zip/ansible/module_utils/mysql.py", line 81, in mysql_connect
    db_connection = mysql_driver.connect(**config)
  File "/usr/lib/python3.6/site-packages/pymysql/__init__.py", line 94, in Connect
    return Connection(*args, **kwargs)
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 327, in __init__
    self.connect()
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 588, in connect
    self._request_authentication()
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 853, in _request_authentication
    auth_packet = self._read_packet()
  File "/usr/lib/python3.6/site-packages/pymysql/connections.py", line 676, in _read_packet
    packet.raise_for_error()
  File "/usr/lib/python3.6/site-packages/pymysql/protocol.py", line 223, in raise_for_error
    err.raise_mysql_exception(self._data)
  File "/usr/lib/python3.6/site-packages/pymysql/err.py", line 107, in raise_mysql_exception
    raise errorclass(errno, errval)
fatal: [db-003]: FAILED! => {
    "changed": false,
    "invocation": {
        "module_args": {
            "ca_cert": null,
            "client_cert": null,
            "client_key": null,
            "collation": "",
            "config_file": "/root/.my.cnf",
            "connect_timeout": 30,
            "encoding": "",
            "ignore_tables": [],
            "login_host": "localhost",
            "login_password": null,
            "login_port": 3306,
            "login_unix_socket": null,
            "login_user": null,
            "name": [
                "test"
            ],
            "quick": true,
            "single_transaction": false,
            "state": "absent",
            "target": null
        }
    },
    "msg": "unable to connect to database, check login_user and login_password are correct or /root/.my.cnf has the credentials. Exception message: (1045, \"Access denied for user 'root'@'127.0.0.1' (using password: YES)\")"
}
ksuehring commented 1 year ago

It seems, I'm also affected by this issue on a Rocky 8.7 target machine.

The role works well with the same settings using MariaDB 10.3. But if I switch the application stream to MariaDB 10.5, the role fails when trying to remove the test database (which does not exist). But the error is an authentication error as well, which is weird, because I can access the database server as root with the mysql command line.

github-actions[bot] commented 1 year ago

This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!

Please read this blog post to see the reasons why I mark issues as stale.

github-actions[bot] commented 10 months ago

This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.