minikube : mysql : Access denied for user 'root'@'127.0.0.1' (using password: YES)

4/26/2020
  1. I have installed mysql in minikube
  2. exposed port 3306 using port forwarding [ want to access MySQL using workbench ]
  3. getting the error when trying to connect to MySQL [ Access denied for user 'root'@'127.0.0.1' (using password: YES) ]

My YML file for mysql

apiVersion: v1
kind: Service
metadata:
  name: mysql
  labels:
    app: mysql
spec:
  ports:
  - port: 3306
    name: mysql
    targetPort: 3306
  selector:
    app: mysql
---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: mysql
spec:
  selector:
    matchLabels:
      app: mysql
  template:
    metadata:
      labels:
        app: mysql
    spec:
      containers:
      - image: mysql:latest
        name: mysql
        env:
        - name: MYSQL_ROOT_PASSWORD
          value: adminadmin
        ports:
        - containerPort: 3306
          name: mysql
        volumeMounts:
        - name: mysql-persistent-storage
          mountPath: /var/lib/mysql
      volumes:
      - name: mysql-persistent-storage
        hostPath:
          path: /mnt/data

My port forwarding command is

kubectl port-forward <<PODNAME>> 3306:3306 --address 0.0.0.0

When trying to access from local MySQL workbench ..i am getting following error

Access denied for user 'root'@'127.0.0.1' (using password: YES)

Expectation is to connect to MySQL from local workbench.

-- ajoy sinha
kubernetes
minikube
mysql
mysql-workbench

0 Answers