I have mysql 8.0.29 installed and I am unable to set its root password using ansible. The documentation at https://docs.ansible.com/ansible/latest/collections/community/mysql/mysql_user_module.html#notes says
- change the root user’s password, without providing any login_user/login_password details
So my playbook goes like:
- mysql_user:
login_user: ''
login_password: ''
name: root
password: "password"
priv: "*.*:ALL,GRANT"
host: "{{ item }}"
with_items:
- "127.0.0.1"
- "::1"
- "localhost"
which returns
unable to connect to database, check login_user and login_******** are correct or /root/.my.cnf has the credentials. Exception message: (1698, \"Access denied for user 'root'@'localhost'\")"}
The other way I tried was setting skip-grant-tables in /etc/mysql/mysql.cnf file as below:
[mysqld]
skip-grant-tables
However when I fire command
mysql -u root -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';"
it returns error as:
ERROR 1524 (HY000): Plugin 'auth_socket' is not loaded
I am absolutely clueless how to proceed ahead as the solutions people have tried on the internet are not working for me :-( Can anyone please help...