mysql-operator: ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)

kubernetes:1.14.4 mysql-operator:0.3.1 The root password cannot access:

[root@kubeone-cp-0 mysql-operator]# kubectl exec -it my-cluster-mysql-0 /bin/bash
Defaulting container name to mysql.
Use 'kubectl describe pod/my-cluster-mysql-0 -n presslabs' to see all of the containers in this pod.
bash-4.2$ mysql -uroot
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
bash-4.2$ mysql -uroot -p
Enter password: 
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Comments: 16 (5 by maintainers)

Most upvoted comments

@pennpeng use echo -n 123456 | base64

As I can see your root password has a new line in it.

MTIzNDU2Cg== is decoded as 123456\n

The right encoding should be MTIzNDU2 for 123456.

Please let me know if this is the case.

After a bit more investigation I realized this was due to the base64 encoded values for the secret keys. I was adding a new line at the end of the strings for some weird reason. The value for database name was causing mysql-init-only container to error out due to this maformated name,