I have instaledl mariadb-server using the dnf module and when it comes time to change the default blank password, I have no success with various options passed to the mysql_user module. Access denied even tho I can "login" directly with the root/ option on the node.
I successfully 'dnf' mariadb-server (RHEL 9.2), I attempt to change the default blank password with:
- name: Set root user to password
mysql_user:
check_implicit_admin: true
login_host: 'localhost'
login_user: 'root'
login_password: ''
name: 'root'
password: '12345'
state: present
become: yes
I keep getting:
fatal: [node1]: FAILED! => {"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'\")"}
For the record, I can log into each node and 'sudo mysql -u root -h localhost' with no issue.
You cannot login as passwordless root via -h localhost
(which is what it defaults to). One must also include in the above statements login_unix_socket: /var/lib/mysql/mysql.sock
for it to work.