요약
- MYSQL import 후 flush privilege 하니 login이 안됨
- sudo 권한이 없기 때문에 조치를 할수가 없었음
- 다행히 세팅 기간이라, db 날리고 다시 import함
- logout 하고 다시 들어와서 flush하니가 됨
상황
sqldump를 뜨고 mysql.user 테이블을 조회하니 아무 값이 나오지 않음
혹시 flush privileges 문제인가 싶어서 입력하면
root@localhost도 권한이 사라져서 접속 자체가 안되는 현상 발견
https://dba.stackexchange.com/questions/112620/mysql-users-not-visible-after-import
비슷한 현상을 가진 글을 발견햇는데
이 분도 flush 했다가 db 접근 자체가 안된다고 한다.
k8s에서는 POD 재시작하면 다시 올라오지 않는다.
2022-09-22 1:18:28 4 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
2022-09-22 1:18:28 5 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
$ k logs mariadb-primary-0 -n mariadb
mariadb 01:18:26.28
mariadb 01:18:26.28 Welcome to the Bitnami mariadb container
mariadb 01:18:26.28 Subscribe to project updates by watching
https://github.com/bitnami/bitnami-docker-mariadb
mariadb 01:18:26.28 Submit issues and feature requests at
https://github.com/bitnami/bitnami-docker-mariadb/issues
mariadb 01:18:26.28
mariadb 01:18:26.28 INFO ==> ** Starting MariaDB setup **
mariadb 01:18:26.29 INFO ==> Validating settings in MYSQL_*/MARIADB_* env vars
mariadb 01:18:26.30 INFO ==> Initializing mariadb database
mariadb 01:18:26.30 DEBUG ==> Ensuring expected directories/files exist
mariadb 01:18:26.30 WARN ==> The mariadb configuration file '/opt/bitnami/mariadb/conf/my.cnf' is not writable. Configurations based on environment variables will not be applied for this file.
mariadb 01:18:26.30 INFO ==> Using persisted data
mariadb 01:18:26.32 INFO ==> Running mysql_upgrade
mariadb 01:18:26.32 INFO ==> Starting mariadb in background
2022-09-22 1:18:26 0 [Note] /opt/bitnami/mariadb/sbin/mysqld (server 10.6.5-MariaDB-log) starting as process 53 ...
2022-09-22 1:18:26 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2022-09-22 1:18:26 0 [Note] InnoDB: Number of pools: 1
2022-09-22 1:18:26 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2022-09-22 1:18:26 0 [Note] mysqld: O_TMPFILE is not supported on /opt/bitnami/mariadb/tmp (disabling future attempts)
2022-09-22 1:18:26 0 [Note] InnoDB: Using Linux native AIO
2022-09-22 1:18:26 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2022-09-22 1:18:26 0 [Note] InnoDB: Completed initialization of buffer pool
2022-09-22 1:18:26 0 [Note] InnoDB: 128 rollback segments are active.
2022-09-22 1:18:26 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2022-09-22 1:18:26 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2022-09-22 1:18:26 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2022-09-22 1:18:26 0 [Note] InnoDB: 10.6.5 started; log sequence number 3154390410; transaction id 6622
2022-09-22 1:18:26 0 [Note] Plugin 'FEEDBACK' is disabled.
2022-09-22 1:18:26 0 [Note] InnoDB: Loading buffer pool(s) from /bitnami/mariadb/data/ib_buffer_pool
2022-09-22 1:18:26 0 [Note] InnoDB: Buffer pool(s) load completed at 220922 1:18:26
2022-09-22 1:18:26 0 [Note] Server socket created on IP: '127.0.0.1'.
2022-09-22 1:18:26 0 [Note] /opt/bitnami/mariadb/sbin/mysqld: ready for connections.
Version: '10.6.5-MariaDB-log' socket: '/opt/bitnami/mariadb/tmp/mysql.sock' port: 3306 Source distribution
2022-09-22 1:18:28 4 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
2022-09-22 1:18:28 5 [Warning] Access denied for user 'root'@'localhost' (using password: YES)
Version check failed. Got the following error when calling the 'mysql' command line client
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
FATAL ERROR: Upgrade failed
mariadb 01:18:28.35 INFO ==> Stopping mariadb
2022-09-22 1:18:28 0 [Note] /opt/bitnami/mariadb/sbin/mysqld (initiated by: unknown): Normal shutdown
2022-09-22 1:18:28 0 [Note] InnoDB: FTS optimize thread exiting.
2022-09-22 1:18:28 0 [Note] InnoDB: Starting shutdown...
2022-09-22 1:18:28 0 [Note] InnoDB: Dumping buffer pool(s) to /bitnami/mariadb/data/ib_buffer_pool
2022-09-22 1:18:28 0 [Note] InnoDB: Restricted to 2024 pages due to innodb_buf_pool_dump_pct=25
2022-09-22 1:18:28 0 [Note] InnoDB: Buffer pool(s) dump completed at 220922 1:18:28
2022-09-22 1:18:28 0 [Note] InnoDB: Removed temporary tablespace data file: "./ibtmp1"
2022-09-22 1:18:28 0 [Note] InnoDB: Shutdown completed; log sequence number 3154390422; transaction id 6623
2022-09-22 1:18:28 0 [Note] /opt/bitnami/mariadb/sbin/mysqld: Shutdown complete
조치
문제는 생각보다 간단
session 끊고 다시 들어오면 mysql.user가 보인다.
이대 flush하면 권한 문제도 정상 작동된다.
평소에는 cli로 import하고, 다시 로그인해서 flush privelege 하는데
dbeaver에 같은 session을 맺고, cli에서 import 후
동일한 connection으로 flush 해서 권한이 다 날라간 것 같다.
큰일날번했다.
k8s mariadb에서 경험했던 일인데, 다행히 db가 처음 세팅하는거라
날리고 새로 pvc를 생성했다.
요즘 mariadb 때문에 다이나믹하다.
'Storage > RDMS' 카테고리의 다른 글
Postgresql) connection 끊기 (0) | 2021.10.08 |
---|---|
PostgreSql) Centos7에 Psql 설치 후 설정 (0) | 2021.09.01 |