Thursday, January 26, 2023

unable to find /root/.my.cnf. Exception message: (1698, \"Access denied for user 'root'@'localhost

 While running Ansible 2.14.1, i am getting the error

"unable to find /root/.my.cnf. Exception message: (1698, \"Access denied for user 'root'@'localhost

Solution to fix is :

You need to login to the server and find the mysqld.sock file. In my Ubuntu22 machine its /var/run/mysqld/mysqld.sock

I need to update this in my playbook as

- name: Create Application database
mysql_db: name=employee_db state=present login_unix_socket=/var/run/mysqld/mysqld.sock

- name: Create Database User
mysql_user:
name : db_user
password: Passw0rd
priv: '*.*:ALL'
login_unix_socket: /var/run/mysqld/mysqld.sock
state: present

No comments:

Post a Comment