Hi All,
I am trying to configure a fresh MySQL installation: Server version: 8.0.40-0ubuntu0.20.04.1 (Ubuntu)
The script sets up variables, and calls a role that starts with the following
- name: Start MySQL service
service:
name: mysql
state: started
enabled: yes
- name: Update MySQL root password
mysql_user:
name: root
password: "{{ mysql_root_password }}"
- name: Copy .my.cnf file with root password credentials
template:
src: files/my.cnf.j2
dest: /root/.my.cnf
owner: root
mode: 0600
The second step erros with
TASK [configMysql : Update MySQL root password] ******************************************************************************************************
fatal: [ganymede.hcs]: 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ā")ā}
If I swap steps 2 and 3 about I get the same error on the same step (now 3).
Some things I have found after I went on the target machine with ssh
Last login: Wed Dec 4 11:42:26 2024 from 192.168.1.151
ian@ganymede:~$ mysql -u root -p
Enter password:
ERROR 1698 (28000): Access denied for user ārootā@ālocalhostā
ian@ganymede:~$ sudo su
[sudo] password for ian:
root@ganymede:/home/ian# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10
Server version: 8.0.40-0ubuntu0.20.04.1 (Ubuntu)
Copyright (c) 2000, 2024, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type āhelp;ā or ā\hā for help. Type ā\cā to clear the current input statement.
mysql>
In short, if I am root, I can log in without a password.
If I am not root, I cannot log in as root. (with or without password)
I want to get into a state where I can import the databases, and set up the users and have root@localhost able to log in to mysql with a password.
Where am I going wrong?
Regards
Ian