카테고리 없음

GCP - Cloud SQL dump

필유아사 2022. 5. 25. 18:16

GCP Cloud SQL 

- 기존 mysql 5.7에서 mysql 8.0 으로 데이터 이관 작업

 

export

sqldump

 

mysqldump -h <db_ip> --routines -u <user> -p --databases aicd --default-character-set=utf8mb4 --column-statistics=0 --set-gtid-purged=OFF > db_dump.sql

 

 

 

오류 1) mysql로 dump 받은 파일로 데이터 로드 시 오류 발생

 error: exit status 1 stdout(capped at 100k bytes): stderr: ERROR 1231 (42000) at line 3604: Variable 'sql_mode' can't be set to the value of 'NO_AUTO_CREATE_USER'

 

조치 1) 계정 생성 후 다시 데이터 로드

동일 오류 발생

 

조치 2) dump 받은 파일에서 NO_AUTO_CREATE_USER 삭제 후 로드

아래 오류 발생

error: exit status 1 stdout(capped at 100k bytes): stderr: ERROR 1418 (HY000) at line 2066: This function has none of DETERMINISTIC, NO SQL, or READS SQL DATA in its declaration and binary logging is enabled (you *might* want to use the less safe log_bin_trust_function_creators variable)

==> 조치 방법

GCP Cloud SQL 의 아래 flag 값을 설정

log_bin_trust_function_creators 를 사용으로 설정