oracle / mysql-operator

Create, operate and scale self-healing MySQL clusters in Kubernetes
869 stars 235 forks source link

failed to "Verify that you can connect to MySQL" according to quick start guide #224

Open k19810703 opened 6 years ago

k19810703 commented 6 years ago

I followed quick start guide to start a cluster. Everythink seems fine.

➜ mysql-operator git:(master) ✗ kubectl get pods --namespace=mysqltest NAME READY STATUS RESTARTS AGE my-app-db-0 2/2 Running 0 31m my-app-db-1 2/2 Running 0 27m my-app-db-2 2/2 Running 0 24m

but in the last step , I failed to connect mysql. ➜ mysql-operator git:(master) ✗ kubectl --namespace=mysqltest run mysql-client --image=mysql:5.7 -it --rm --restart=Never \ -- mysql -hmy-app-db -uroot -pxs17uXpPE5bBe5TB -e 'SELECT 1' mysql: [Warning] Using a password on the command line interface can be insecure. ERROR 1045 (28000): Access denied for user 'root'@'10.244.1.190' (using password: YES) pod mysqltest/mysql-client terminated (Error)

owainlewis commented 6 years ago

Can you double check your password is correct?

kubectl exec -n mysqltest -it my-app-db-0 /bin/bash 
env | grep MYSQL_ROOT_PASSWORD
mysql -u root -p$MYSQL_ROOT_PASSWORD
k19810703 commented 5 years ago

@owainlewis
I can log in mysql use that password via kubectl exec ➜ ~ kubectl exec -n mysqltest -it my-app-db-0 /bin/bash Defaulting container name to mysql. Use 'kubectl describe pod/my-app-db-0' to see all of the containers in this pod. bash-4.2# env | grep MYSQL_ROOT_PASSWORD MYSQL_ROOT_PASSWORD=xs17uXpPE5bBe5TB bash-4.2# mysql -u root -p$MYSQL_ROOT_PASSWORD mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 23969 Server version: 8.0.11 MySQL Community Server - GPL

Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.

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>

but it doesn't work via mysql client

ruiaylin commented 5 years ago

you should change the hostname my-app-db to your ip address , that will work ok .

ruiaylin commented 5 years ago

@k19810703