mysql配置文件'/opt/bitnami/mysql/conf/my.cnf';是不可写的
现在我在kubernetes 1.15中使用此命令暂停mysql:mysql配置文件'/opt/bitnami/mysql/conf/my.cnf';是不可写的,mysql,Mysql,现在我在kubernetes 1.15中使用此命令暂停mysql: $ helm repo add bitnami https://charts.bitnami.com/bitnami $ helm install my-release bitnami/mysql mysql有状态集启动时,显示以下警告: mysql 11:12:23.57 WARN ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is
$ helm repo add bitnami https://charts.bitnami.com/bitnami
$ helm install my-release bitnami/mysql
mysql有状态集启动时,显示以下警告:
mysql 11:12:23.57 WARN ==> The mysql configuration file '/opt/bitnami/mysql/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
我已经更改了kubernetes secrets中的mysql根密码,现在我无法使用新密码登录mysql,我应该怎么做才能修复它?我正在使用此命令登录:
mycli -h 172.30.184.8 -u mysql -p 9Ve5TEHgcY // way 1
mysql -h localhost -uroot -p 6a4vUXlTyeRvzizZ // way 2
显示错误:
Access denied for user 'root'@'localhost' (using password: YES)'
Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure. mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
我应该怎么做来修复警告?并成功登录mysql。这是有状态集定义:
{
"kind": "StatefulSet",
"apiVersion": "apps/v1beta2",
"metadata": {
"name": "ajidou-mysql",
"namespace": "dabai-fat",
"selfLink": "/apis/apps/v1beta2/namespaces/dabai-fat/statefulsets/ajidou-mysql",
"uid": "894b8cfe-c000-408e-9eee-f0b18eff9aed",
"resourceVersion": "81999050",
"generation": 9,
"creationTimestamp": "2021-04-26T10:11:23Z",
"labels": {
"app.kubernetes.io/component": "primary",
"app.kubernetes.io/instance": "ajidou-mysql",
"app.kubernetes.io/managed-by": "Helm",
"app.kubernetes.io/name": "mysql",
"helm.sh/chart": "mysql-8.5.5"
},
"annotations": {
"meta.helm.sh/release-name": "ajidou-mysql",
"meta.helm.sh/release-namespace": "dabai-fat"
}
},
"spec": {
"replicas": 1,
"selector": {
"matchLabels": {
"app.kubernetes.io/component": "primary",
"app.kubernetes.io/instance": "ajidou-mysql",
"app.kubernetes.io/name": "mysql"
}
},
"template": {
"metadata": {
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/component": "primary",
"app.kubernetes.io/instance": "ajidou-mysql",
"app.kubernetes.io/managed-by": "Helm",
"app.kubernetes.io/name": "mysql",
"helm.sh/chart": "mysql-8.5.5"
},
"annotations": {
"checksum/configuration": "41e7174a05fda333d37a84fdb7a7730102c7036e38fcbacd7567e3d58b3e675e"
}
},
"spec": {
"volumes": [
{
"name": "config",
"configMap": {
"name": "ajidou-mysql",
"defaultMode": 420
}
}
],
"containers": [
{
"name": "mysql",
"image": "docker.io/bitnami/mysql:8.0.24-debian-10-r0",
"ports": [
{
"name": "mysql",
"containerPort": 3306,
"protocol": "TCP"
}
],
"env": [
{
"name": "BITNAMI_DEBUG",
"value": "false"
},
{
"name": "MYSQL_ROOT_PASSWORD",
"valueFrom": {
"secretKeyRef": {
"name": "ajidou-mysql",
"key": "mysql-root-password"
}
}
},
{
"name": "MYSQL_DATABASE",
"value": "my_database"
}
],
"resources": {},
"volumeMounts": [
{
"name": "data",
"mountPath": "/bitnami/mysql"
},
{
"name": "config",
"mountPath": "/opt/bitnami/mysql/conf/my.cnf",
"subPath": "my.cnf"
}
],
"livenessProbe": {
"exec": {
"command": [
"/bin/bash",
"-ec",
"password_aux=\"${MYSQL_ROOT_PASSWORD:-}\"\nif [[ -f \"${MYSQL_ROOT_PASSWORD_FILE:-}\" ]]; then\n password_aux=$(cat \"$MYSQL_ROOT_PASSWORD_FILE\")\nfi\nmysqladmin status -uroot -p\"${password_aux}\"\n"
]
},
"initialDelaySeconds": 120,
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
"readinessProbe": {
"exec": {
"command": [
"/bin/bash",
"-ec",
"password_aux=\"${MYSQL_ROOT_PASSWORD:-}\"\nif [[ -f \"${MYSQL_ROOT_PASSWORD_FILE:-}\" ]]; then\n password_aux=$(cat \"$MYSQL_ROOT_PASSWORD_FILE\")\nfi\nmysqladmin status -uroot -p\"${password_aux}\"\n"
]
},
"initialDelaySeconds": 30,
"timeoutSeconds": 1,
"periodSeconds": 10,
"successThreshold": 1,
"failureThreshold": 3
},
"terminationMessagePath": "/dev/termination-log",
"terminationMessagePolicy": "File",
"imagePullPolicy": "IfNotPresent",
"securityContext": {
"runAsUser": 1001
}
}
],
"restartPolicy": "Always",
"terminationGracePeriodSeconds": 30,
"dnsPolicy": "ClusterFirst",
"serviceAccountName": "ajidou-mysql",
"serviceAccount": "ajidou-mysql",
"securityContext": {
"fsGroup": 1001
},
"affinity": {
"podAntiAffinity": {
"preferredDuringSchedulingIgnoredDuringExecution": [
{
"weight": 1,
"podAffinityTerm": {
"labelSelector": {
"matchLabels": {
"app.kubernetes.io/component": "primary",
"app.kubernetes.io/instance": "ajidou-mysql",
"app.kubernetes.io/name": "mysql"
}
},
"namespaces": [
"dabai-fat"
],
"topologyKey": "kubernetes.io/hostname"
}
}
]
}
},
"schedulerName": "default-scheduler"
}
},
"volumeClaimTemplates": [
{
"metadata": {
"name": "data",
"creationTimestamp": null,
"labels": {
"app.kubernetes.io/component": "primary",
"app.kubernetes.io/instance": "ajidou-mysql",
"app.kubernetes.io/name": "mysql"
}
},
"spec": {
"accessModes": [
"ReadWriteOnce"
],
"resources": {
"requests": {
"storage": "8Gi"
}
},
"volumeMode": "Filesystem"
},
"status": {
"phase": "Pending"
}
}
],
"serviceName": "ajidou-mysql",
"podManagementPolicy": "OrderedReady",
"updateStrategy": {
"type": "RollingUpdate"
},
"revisionHistoryLimit": 10
},
"status": {
"observedGeneration": 9,
"replicas": 1,
"currentReplicas": 1,
"updatedReplicas": 1,
"currentRevision": "ajidou-mysql-f69895f8c",
"updateRevision": "ajidou-mysql-f69895f8c",
"collisionCount": 0
}
}
现在我尝试在kubernetes中重新安装mysql,并使用初始密码登录mysql:
$ exec kubectl exec -i -t -n dabai-fat ajidou-mysql-0 -c mysql "--" sh -c "clear; (bash || ash || sh)" ‹ruby-2.7.2›
sh: 1: clear: not found
I have no name!@ajidou-mysql-0:/$ mysql -h 172.30.184.8 -uroot -p F7cVhpiRsC
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'172.30.184.8' (using password: YES)
I have no name!@ajidou-mysql-0:/$ mysql -h 172.30.184.8 -uroot -p F7cVhpiRsC
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'172.30.184.8' (using password: YES)
I have no name!@ajidou-mysql-0:/$ mysql -h 172.30.184.8 -uroot -p F7cVhpiRsC
Enter password:
ERROR 1045 (28000): Access denied for user 'root'@'172.30.184.8' (using password: YES)
I have no name!@ajidou-mysql-0:/$
用户界面显示错误:
Access denied for user 'root'@'localhost' (using password: YES)'
Readiness probe failed: mysqladmin: [Warning] Using a password on the command line interface can be insecure. mysqladmin: connect to server at 'localhost' failed error: 'Can't connect to local MySQL server through socket '/opt/bitnami/mysql/tmp/mysql.sock' (2)' Check that mysqld is running and that the socket: '/opt/bitnami/mysql/tmp/mysql.sock' exists!
请参见:?或:或:但关于在MySQL上更改密码还有很多问题。我重新安装了MySQL,使用初始密码仍然无法登录MySQL@luk