How to resolve definer ERROR 1227 (42000) when importing data to Azure/Amazon RDS for MySQL DB instance using mysqldump?

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

アトラシアン社外秘

This article is Archived and cannot be shared with customers.


プラットフォームについて: Server および Data Center のみ。この記事は、Server および Data Center プラットフォームのアトラシアン製品にのみ適用されます。

Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Fisheye および Crucible は除く

要約

When importing data to an Azure/Amazon RDS for MySQL DB instance using mysqldump, you may receive an error similar to the following:

ERROR 1227 (42000) at line xxxxx: Access denied; you need (at least one of) the SUPER privilege(s) for this operation


環境

  • Confluence 7.11.0+
  • Amazon/Azure MySQL

診断

  • Make sure log_bin_trust_function_creators value has been set correctly on Azure and AWS per this KB
  • Make sure you have followed this KB to dump the MySQL database if your confluence version is 7.11+
  • Checking the DB dump at line xxxxxx 

    sed -n 'xxxxxx,+10p' DB_dump_name

    If you see the output lines similar to the following, this KB applies to you: 

    /!50003 CREATE/ /!50017 DEFINER=`confluence`@`localhost`/ /*!50003 TRIGGER denormalised_content_trigger_on_insert
    AFTER INSERT
    ON CONTENT FOR EACH ROW
    sp: BEGIN
    DECLARE isServiceDisabled BOOL DEFAULT TRUE;
    CALL content_procedure_for_denormalised_permissions(isServiceDisabled);
    IF (isServiceDisabled) THEN
    LEAVE sp;
    END IF;

原因

Definer errors are triggered when MySQL attempts to create an object under a database user, and that database user doesn't exist on the destination database. This usually happened when you are trying to migrate the on-perms MySQL database to Azure/Amazon RDS. When MySQL attempts to create a user for localhost, which is not permitted for Azure/Amazon RDS. This is because Amazon/Azure RDS doesn't have superuser privileges.

ソリューション

Rename the definer users to the current user and host:

Example: From confluence@loccalhost to confluenceazure@%
sed -i -e 's/DEFINER=`confluence`@`localhost`/DEFINER=`confluenceazure`@`%`/g' dump.sql

You can remote access Azure/Amazon RDS to verify the local DB admin account: 


show grants;




Last modified on Mar 7, 2022

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.