DB/MySQL

[MariaDB] "Incorrect definition of table mysql.event" 오류 해결 방법

채윤아빠 2021. 8. 22. 17:12
728x90
반응형

도커를 이용하여 "MariaDB-10.4.15"를 운영 중이다가 오랜만에 "MariaDB-10.6.4"로 버전을 업그레이드 한 이후에, 로그에 다음과 같은 오류 기록이 남아 있었습니다.

# ./start-mariadb.sh
========
[2021-08-22 14:08:32] ./start-mariadb.sh
MariaDB 컨테이너 생성
ea3e5e778ec53f5b325420cb23e72c22d912b6e3328fd04151d2e9cc09705b89
[root@hbesthee-60337 www1]# docker logs mariadb
2021-08-22  5:08:34 0 [Note] /usr/bin/mysqld (server 10.6.4-MariaDB-debug) starting as process 1 ...
2021-08-22  5:08:35 0 [Note] InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2021-08-22  5:08:35 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-22  5:08:35 0 [Note] InnoDB: Number of pools: 1
2021-08-22  5:08:35 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-08-22  5:08:35 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2021-08-22  5:08:35 0 [Note] InnoDB: Using Linux native AIO
2021-08-22  5:08:35 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2021-08-22  5:08:35 0 [Note] InnoDB: Completed initialization of buffer pool
2021-08-22  5:08:35 0 [Note] InnoDB: Upgrading redo log: 100663296 bytes; LSN=617049285
2021-08-22  5:08:35 0 [Note] InnoDB: Starting to delete and rewrite log file.
2021-08-22  5:08:35 0 [Note] InnoDB: Setting log file ./ib_logfile101 size to 100663296 bytes
2021-08-22  5:08:35 0 [Note] InnoDB: Renaming log file ./ib_logfile101 to ./ib_logfile0
2021-08-22  5:08:35 0 [Note] InnoDB: New log file created, LSN=617049285
2021-08-22  5:08:35 0 [Note] InnoDB: 128 rollback segments are active.
2021-08-22  5:08:35 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-08-22  5:08:35 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-08-22  5:08:35 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-08-22  5:08:35 0 [Note] InnoDB: 10.6.4 started; log sequence number 617049273; transaction id 4427529
2021-08-22  5:08:35 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-08-22  5:08:35 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-08-22  5:08:35 0 [Note] Server socket created on IP: '0.0.0.0'.
2021-08-22  5:08:35 0 [ERROR] Incorrect definition of table mysql.event: expected column 'definer' at position 3 to have type varchar(, found type char(141).
2021-08-22  5:08:35 0 [ERROR] mysqld: Event Scheduler: An error occurred when initializing system tables. Disabling the Event Scheduler.
2021-08-22  5:08:35 0 [Note] /usr/bin/mysqld: ready for connections.
Version: '10.6.4-MariaDB-debug'  socket: '/run/mysqld/mysqld.sock'  port: 23306  MariaDB Server

기본적인 데이터베이스 동작에는 아무런 문제가 없었지만, 그래도 최초 실행될 때, "ERROR" 로그가 있는 것은 좀 껄끄러워 해결 방법을 찾아보니, 아주 간단한 문제였습니다.

 

하지만, 제 경우 Alpine 리눅스 기반으로 경량화한 컨테이너를 만들어서 사용하다 보니, mysqlcheck, mariadb-upgrade 등의 명령이 없어서 그 부분을 해결하느라 많은 시간을 소모했었습니다.

해결 방법

해결 방법은 간단합니다. 다음과 같이 "mariadb" 서비스 컨테이너 내부에 "mariadb-upgrade" 명령을 실행하여 데이터베이스 업그레이드를 수행합니다.

$ docker exec -it mariadb /bin/sh
$ /usr/bin/mariadb-upgrade
Phase 1/7: Checking and upgrading mysql database
Processing databases
mysql
mysql.column_stats                                 OK
mysql.columns_priv                                 OK
mysql.db                                           OK
mysql.event                                        OK
mysql.func                                         OK
mysql.global_priv                                  OK
mysql.gtid_slave_pos                               OK
mysql.help_category                                OK
mysql.help_keyword                                 OK
mysql.help_relation                                OK
mysql.help_topic                                   OK
mysql.index_stats                                  OK
mysql.innodb_index_stats                           OK
mysql.innodb_table_stats                           OK
mysql.plugin                                       OK
mysql.proc                                         OK
mysql.procs_priv                                   OK
mysql.proxies_priv                                 OK
mysql.roles_mapping                                OK
mysql.servers                                      OK
mysql.table_stats                                  OK
mysql.tables_priv                                  OK
mysql.time_zone                                    OK
mysql.time_zone_leap_second                        OK
mysql.time_zone_name                               OK
mysql.time_zone_transition                         OK
mysql.time_zone_transition_type                    OK
mysql.transaction_registry                         OK
Phase 2/7: Installing used storage engines... Skipped
Phase 3/7: Fixing views
mysql.user                                         OK
Phase 4/7: Running 'mysql_fix_privilege_tables'
Phase 5/7: Fixing table and database names
Phase 6/7: Checking and upgrading tables
Processing databases
PMS
PMS.ADMINS                                         OK
PMS.PRODUCTS                                       OK
PMS.PRODUCT_FILES                                  OK
PMS.SERIAL_CODES                                   OK
PMS.SUPPLIES                                       OK
PMS.UPDATE_FILES                                   OK
REDMINE
information_schema
performance_schema
sys
sys.sys_config                                     OK
Phase 7/7: Running 'FLUSH PRIVILEGES'
OK

업그레이드가 완료된 이후에, "mariadb" 컨테이너를 중지하였다가 재시작하면, 관련 오류가 사라지고 정상적으로 MariaDB 서비스가 시작됩니다.

# docker logs mariadb
2021-08-22  7:05:04 0 [Note] /usr/bin/mysqld (server 10.6.4-MariaDB-debug) starting as process 1 ...
2021-08-22  7:05:04 0 [Note] InnoDB: !!!!!!!! UNIV_DEBUG switched on !!!!!!!!!
2021-08-22  7:05:04 0 [Note] InnoDB: Compressed tables use zlib 1.2.11
2021-08-22  7:05:04 0 [Note] InnoDB: Number of pools: 1
2021-08-22  7:05:04 0 [Note] InnoDB: Using crc32 + pclmulqdq instructions
2021-08-22  7:05:04 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2021-08-22  7:05:04 0 [Note] InnoDB: Using Linux native AIO
2021-08-22  7:05:04 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2021-08-22  7:05:04 0 [Note] InnoDB: Completed initialization of buffer pool
2021-08-22  7:05:04 0 [Note] InnoDB: 128 rollback segments are active.
2021-08-22  7:05:04 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2021-08-22  7:05:04 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2021-08-22  7:05:04 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2021-08-22  7:05:04 0 [Note] InnoDB: 10.6.4 started; log sequence number 617717948; transaction id 4434154
2021-08-22  7:05:04 0 [Note] Plugin 'FEEDBACK' is disabled.
2021-08-22  7:05:04 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-08-22  7:05:04 0 [Note] Server socket created on IP: '0.0.0.0'.
2021-08-22  7:05:04 0 [Note] /usr/bin/mysqld: ready for connections.
Version: '10.6.4-MariaDB-debug'  socket: '/run/mysqld/mysqld.sock'  port: 23306  MariaDB Server
2021-08-22  7:05:06 0 [Note] InnoDB: Buffer pool(s) load completed at 210822  7:05:06

참고자료