<span id="mktg5"></span>

<i id="mktg5"><meter id="mktg5"></meter></i>

        <label id="mktg5"><meter id="mktg5"></meter></label>
        最新文章專題視頻專題問答1問答10問答100問答1000問答2000關鍵字專題1關鍵字專題50關鍵字專題500關鍵字專題1500TAG最新視頻文章推薦1 推薦3 推薦5 推薦7 推薦9 推薦11 推薦13 推薦15 推薦17 推薦19 推薦21 推薦23 推薦25 推薦27 推薦29 推薦31 推薦33 推薦35 推薦37視頻文章20視頻文章30視頻文章40視頻文章50視頻文章60 視頻文章70視頻文章80視頻文章90視頻文章100視頻文章120視頻文章140 視頻2關鍵字專題關鍵字專題tag2tag3文章專題文章專題2文章索引1文章索引2文章索引3文章索引4文章索引5123456789101112131415文章專題3
        問答文章1 問答文章501 問答文章1001 問答文章1501 問答文章2001 問答文章2501 問答文章3001 問答文章3501 問答文章4001 問答文章4501 問答文章5001 問答文章5501 問答文章6001 問答文章6501 問答文章7001 問答文章7501 問答文章8001 問答文章8501 問答文章9001 問答文章9501
        當前位置: 首頁 - 科技 - 知識百科 - 正文

        UsingMySQLtriggersandviewsinAmazonRDS_MySQL

        來源:懂視網 責編:小采 時間:2020-11-09 20:00:15
        文檔

        UsingMySQLtriggersandviewsinAmazonRDS_MySQL

        UsingMySQLtriggersandviewsinAmazonRDS_MySQL:I recently had an opportunity to migrate a customer from a physical server into Amazons RDS environment. In this particular case the customers platform makes extensive use of My
        推薦度:
        導讀UsingMySQLtriggersandviewsinAmazonRDS_MySQL:I recently had an opportunity to migrate a customer from a physical server into Amazons RDS environment. In this particular case the customers platform makes extensive use of My
        I recently had an opportunity to migrate a customer from a physical server into Amazon’s RDS environment. In this particular case the customers’ platform makes extensive use of MySQL triggers and views. I came across two significant issues that prevented me from following Amazon’s documentation, which basically states “use mysqldump” but doesn’t call out a specific method of dealing with MySQL triggers and views.

        Amazon Relational Database Service (Amazon RDS) is a great platform if you’re looking for complete hands-off management of your MySQL environment, but comes at a cost in the area of flexibility, i.e. you don’t have SUPER privilege and this brings up additional challenges.

        1. You need to ensure you set log_bin_trust_function_creators=1 ( by default this is off, 0).
        2. You need to clean up your mysqldump syntax.

        #1 is easy, you simply make a configuration change within the Amazon RDS GUI on the node’s Parameter Group to set log_bin_trust_function_creators=1 and then a restart of your Amazon RDS node. The restart is required since without the SUPER privilege you lose access to changing DYNAMIC variables on the fly. #2 is a little more complex. If you go with vanilla mysqldump (from say a 5.5 mysqldump binary) on a schema that has triggers and views, you will see error 1227, something like this:

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

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

        You’re seeing this message because MySQL in Amazon RDS doesn’t provide the SUPER privilege, and thus you cannot set up a trigger or view to run as a different user — only a user with SUPER can do that.

        mysqldump will generate syntax for a trigger like this:

        DELIMITER ;;/*!50003 CREATE*/ /*!50017 DEFINER=`root`@`%`*/ /*!50003 TRIGGER `after_insert_lead` AFTER INSERT ON `leads` FOR EACH ROW BEGINUPDATE analytics.mapping SET id_lead = NEW.id_lead WHERE mc_email = NEW.email;END */;;DELIMITER ;

        DELIMITER ; ;

        / * ! 50003 CREATE * / / * ! 50017 DEFINER = ` root ` @ ` % ` * / / * ! 50003 TRIGGER ` after_insert_lead ` AFTER INSERT ON ` leads ` FOR EACH ROW BEGIN

        UPDATE analytics .mapping SET id_lead = NEW .id_lead WHERE mc_email = NEW .email ;

        END * / ; ;

        DELIMITER ;

        and for a view like this:

        /*!50001 CREATE ALGORITHM=UNDEFINED *//*!50013 DEFINER=`web`@`%` SQL SECURITY DEFINER *//*!50001 VIEW `admin_user_view` AS SELECT ...

        / * ! 50001 CREATE ALGORITHM = UNDEFINED * /

        / * ! 50013 DEFINER = ` web ` @ ` % ` SQL SECURITY DEFINER * /

        / * ! 50001 VIEW ` admin_user_view ` AS SELECT . . .

        The problem is in the “DEFINER” lines.

        Here’s one method that worked for me:

        1. Identify all the DEFINER lines in your schema. I found it helpful to dump out a –no-data and then weed through that to get a unique list of the DEFINER lines
        2. Create a sed line for each unique DEFINER line (see my example in a moment)
        3. Include this sed line in your dump/load script

        Here’s what my sed matches looked like:

        sed-e 's//*!50017 DEFINER=`root`@`localhost`*///'-e 's//*!50017 DEFINER=`root`@`%`*///'-e 's//*!50017 DEFINER=`web`@`%`*///'-e 's//*!50017 DEFINER=`cron`@`%`*///'-e 's//*!50013 DEFINER=`cron`@`%` SQL SECURITY DEFINER *///'-e 's//*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER *///'-e 's//*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER *///'-e 's//*!50013 DEFINER=`web`@`%` SQL SECURITY DEFINER *///'

        sed

        - e 's//*!50017 DEFINER=`root`@`localhost`*///'

        - e 's//*!50017 DEFINER=`root`@`%`*///'

        - e 's//*!50017 DEFINER=`web`@`%`*///'

        - e 's//*!50017 DEFINER=`cron`@`%`*///'

        - e 's//*!50013 DEFINER=`cron`@`%` SQL SECURITY DEFINER *///'

        - e 's//*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER *///'

        - e 's//*!50013 DEFINER=`root`@`%` SQL SECURITY DEFINER *///'

        - e 's//*!50013 DEFINER=`web`@`%` SQL SECURITY DEFINER *///'

        Note: the example above won’t directly work due to WordPress “helpfully” stripping my text… you need to escape the forward slashes and asterisks.

        A big caveat: this method is akin to a brute force method of getting your data into Amazon RDS — you’ve lost the elegance & security of running your triggers and views as separate defined users within the database — they are all now going to run as the user you loaded them in as. If this is a show-stopper for you, contact Percona and I’d be happy to take on your case and develop a more comprehensive solution. :)

        Now all that’s left is to integrate this into your dump flow. Something like this should work:

        mysqldump--host=source| sed-e ... lots of lines| mysql--host=destination

        mysqldump

        -- host = source

        | sed

        - e . . . lots of lines

        | mysql

        -- host = destination

        I hope this helps someone!

        聲明:本網頁內容旨在傳播知識,若有侵權等問題請及時與本網聯系,我們將在第一時間刪除處理。TEL:177 7030 7066 E-MAIL:11247931@qq.com

        文檔

        UsingMySQLtriggersandviewsinAmazonRDS_MySQL

        UsingMySQLtriggersandviewsinAmazonRDS_MySQL:I recently had an opportunity to migrate a customer from a physical server into Amazons RDS environment. In this particular case the customers platform makes extensive use of My
        推薦度:
        標簽: and Amazon mysql
        • 熱門焦點

        最新推薦

        猜你喜歡

        熱門推薦

        專題
        Top
        主站蜘蛛池模板: 亚洲AV日韩精品久久久久| 国产精品另类激情久久久免费 | 18禁亚洲深夜福利人口| 免费一级毛片在线播放不收费| 女人裸身j部免费视频无遮挡| 亚洲AV无码专区日韩| 国产拍拍拍无码视频免费| 亚洲最大黄色网址| 国产精品无码免费视频二三区| 一级毛片免费在线播放| 亚洲精品在线电影| mm1313亚洲国产精品美女| 日韩免费视频一区二区| 亚洲成av人片在线天堂无| 国产V亚洲V天堂A无码| 麻豆国产VA免费精品高清在线| rh男男车车的车车免费网站 | 午夜亚洲WWW湿好爽| 暖暖免费日本在线中文| 亚洲日韩亚洲另类激情文学| 永久亚洲成a人片777777| 成人午夜视频免费| 一级毛片免费观看不收费| 33333在线亚洲| 亚洲国产精品嫩草影院在线观看 | 亚洲精品高清国产一久久| 免费黄色大片网站| 香蕉免费一区二区三区| 黄色一级毛片免费看| 亚洲AV成人噜噜无码网站| 国产AV无码专区亚洲AVJULIA| 免费一本色道久久一区| 日韩精品免费在线视频| 免费无码午夜福利片 | 亚洲日本va在线观看| 一级毛片免费观看不卡视频| 全黄性性激高免费视频| 中字幕视频在线永久在线观看免费| 亚洲高清毛片一区二区| 亚洲精品无码aⅴ中文字幕蜜桃| 亚洲成AV人片在线观看无码|