<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
        主站蜘蛛池模板: 爽爽日本在线视频免费| 又黄又爽的视频免费看| 中文字幕无码精品亚洲资源网久久| 成人免费午夜视频| 国产男女爽爽爽免费视频 | 77777_亚洲午夜久久多人| 国产大片线上免费观看| 全黄A免费一级毛片| 亚洲Av熟妇高潮30p| 国产精品自在自线免费观看| 99久久99这里只有免费的精品| 亚洲成人午夜电影| 亚洲综合区小说区激情区| 精品熟女少妇a∨免费久久| 亚洲av永久无码精品秋霞电影秋| 亚洲国产精品嫩草影院在线观看 | 国产亚洲精久久久久久无码77777| 四虎成人精品永久免费AV| 亚洲综合一区国产精品| 亚洲人成色7777在线观看| 免费看韩国黄a片在线观看| A级毛片成人网站免费看| 亚洲伊人久久大香线蕉AV| 亚洲AV成人片色在线观看| 成人伊人亚洲人综合网站222| 182tv免费观看在线视频| 一级做a爱过程免费视| 亚洲一级毛片免费看| 亚洲日本va中文字幕久久| 日本免费一本天堂在线| 最新黄色免费网站| aaa毛片免费观看| 无套内谢孕妇毛片免费看看| 亚洲一区二区三区久久久久| 亚洲国产精品热久久| 亚洲午夜福利精品久久| 日本人护士免费xxxx视频| 国产男女爽爽爽爽爽免费视频| 久久久久久久久久久免费精品| 亚洲欧美日韩一区二区三区在线 | 亚洲AV无码一区二区三区鸳鸯影院 |