{"id":2394,"date":"2020-12-10T15:51:45","date_gmt":"2020-12-10T07:51:45","guid":{"rendered":"https:\/\/www.gbase8.cn\/?p=2394"},"modified":"2022-07-11T09:38:17","modified_gmt":"2022-07-11T01:38:17","slug":"gbase-8a%e7%94%a8%e6%88%b7%e8%a7%92%e8%89%b2role%e3%80%81%e7%94%a8%e6%88%b7%e7%bb%84%e7%9a%84%e7%ae%a1%e7%90%86","status":"publish","type":"post","link":"https:\/\/www.gbase8.cn\/en\/2394","title":{"rendered":"\u5357\u5927\u901a\u7528GBase 8a\u7528\u6237\u89d2\u8272role\u3001\u7528\u6237\u7ec4\u7684\u7ba1\u7406"},"content":{"rendered":"<p>GBase 8a\u652f\u6301\u7528\u6237\u7ec4\uff0c\u6216\u8005\u53eb\u7528\u6237\u89d2\u8272\u3002\u7528\u6237\u7ec4\u5185\u7684\u7528\u6237\uff0c\u81ea\u52a8\u62e5\u6709\u7ec4\u7684\u6743\u9650\uff0c\u53ef\u4ee5\u66f4\u9ad8\u6548\u7684\u6279\u91cf\u7ba1\u7406\u7528\u6237\u6743\u9650\u3002<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_84 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Directory Navigation<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-6a2afd75614f2\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewbox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewbox=\"0 0 24 24\" version=\"1.2\" baseprofile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-6a2afd75614f2\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.gbase8.cn\/en\/2394\/#%E5%88%9B%E5%BB%BA%E7%94%A8%E6%88%B7%E7%BB%84\" >\u521b\u5efa\u7528\u6237\u7ec4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.gbase8.cn\/en\/2394\/#%E7%BB%99%E7%94%A8%E6%88%B7%E7%BB%84%E6%8E%88%E6%9D%83\" >\u7ed9\u7528\u6237\u7ec4\u6388\u6743<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.gbase8.cn\/en\/2394\/#%E6%B5%8B%E8%AF%95%E7%94%A8%E6%88%B7%E6%9D%83%E9%99%90\" >\u6d4b\u8bd5\u7528\u6237\u6743\u9650<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.gbase8.cn\/en\/2394\/#%E5%88%A0%E9%99%A4%E7%94%A8%E6%88%B7%E7%BB%84\" >\u5220\u9664\u7528\u6237\u7ec4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.gbase8.cn\/en\/2394\/#%E6%B5%8B%E8%AF%95%E7%94%A8%E6%88%B7%E7%BB%84%E5%88%A0%E9%99%A4%E5%90%8E%E7%9A%84%E7%94%A8%E6%88%B7%E6%9D%83%E9%99%90\" >\u6d4b\u8bd5\u7528\u6237\u7ec4\u5220\u9664\u540e\u7684\u7528\u6237\u6743\u9650<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.gbase8.cn\/en\/2394\/#%E6%9F%A5%E7%9C%8B%E7%94%A8%E6%88%B7%E7%BB%84ROLE\" >\u67e5\u770b\u7528\u6237\u7ec4ROLE<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%9B%E5%BB%BA%E7%94%A8%E6%88%B7%E7%BB%84\"><\/span>\u521b\u5efa\u7528\u6237\u7ec4<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create role testdb_admin;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.01)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E7%BB%99%E7%94%A8%E6%88%B7%E7%BB%84%E6%8E%88%E6%9D%83\"><\/span>\u7ed9\u7528\u6237\u7ec4\u6388\u6743<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; grant all on testdb.* to testdb_admin;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<p>\u6dfb\u52a0\u7528\u6237\u5230\u7528\u6237\u7ec4<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; create user test1 identified by 'test1';\nQuery OK, 0 rows affected (Elapsed: 00:00:00.01)\n\ngbase&gt; grant testdb_admin to test1;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E7%94%A8%E6%88%B7%E6%9D%83%E9%99%90\"><\/span>\u6d4b\u8bd5\u7528\u6237\u6743\u9650<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u53ef\u4ee5\u6b63\u5e38\u767b\u5f55\uff0c\u5e76\u4eab\u6709\u76f8\u5e94\u7684\u6743\u9650\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@gbase_rh7_003 ~]$ gccli -utest1 -ptest1\n\nGBase client 9.5.3.18.123926. Copyright (c) 2004-2020, GBase.  All Rights Reserved.\n\ngbase&gt; show grants;\n+--------------------------------------------------------------------------------------------------------+\n| Grants for test1@%                                                                                     |\n+--------------------------------------------------------------------------------------------------------+\n| GRANT USAGE ON *.*.* TO 'test1'@'%' IDENTIFIED BY PASSWORD '*06C0BF5B64ECE2F648B5F048A71903906BA08E5C' |\n| GRANT \"testdb_admin\" TO \"test1\"                                                                        |\n+--------------------------------------------------------------------------------------------------------+\n2 rows in set (Elapsed: 00:00:00.00)\n\ngbase&gt; use testdb;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.00)\n\ngbase&gt; create table test1(id int);\nQuery OK, 0 rows affected (Elapsed: 00:00:00.14)\n\ngbase&gt; drop table test1;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.05)\n\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E5%88%A0%E9%99%A4%E7%94%A8%E6%88%B7%E7%BB%84\"><\/span>\u5220\u9664\u7528\u6237\u7ec4<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<pre class=\"wp-block-code\"><code>gbase&gt; drop role testdb_admin;\nQuery OK, 0 rows affected (Elapsed: 00:00:00.01)\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%B5%8B%E8%AF%95%E7%94%A8%E6%88%B7%E7%BB%84%E5%88%A0%E9%99%A4%E5%90%8E%E7%9A%84%E7%94%A8%E6%88%B7%E6%9D%83%E9%99%90\"><\/span>\u6d4b\u8bd5\u7528\u6237\u7ec4\u5220\u9664\u540e\u7684\u7528\u6237\u6743\u9650<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u5df2\u7ecf\u4e0d\u518d\u4eab\u6709\u7528\u6237\u7ec4\u7684\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;gbase@gbase_rh7_003 ~]$ gccli -utest1 -ptest1\n\nGBase client 9.5.3.18.123926. Copyright (c) 2004-2020, GBase.  All Rights Reserved.\n\ngbase&gt; show grants;\n+--------------------------------------------------------------------------------------------------------+\n| Grants for test1@%                                                                                     |\n+--------------------------------------------------------------------------------------------------------+\n| GRANT USAGE ON *.*.* TO 'test1'@'%' IDENTIFIED BY PASSWORD '*06C0BF5B64ECE2F648B5F048A71903906BA08E5C' |\n+--------------------------------------------------------------------------------------------------------+\n1 row in set (Elapsed: 00:00:00.00)\n\n\ngbase&gt; use testdb;\nERROR 1044 (42000): Access denied for user 'test1'@'%' to database 'testdb'\n<\/code><\/pre>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"%E6%9F%A5%E7%9C%8B%E7%94%A8%E6%88%B7%E7%BB%84ROLE\"><\/span>\u67e5\u770b\u7528\u6237\u7ec4ROLE<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>\u67e5\u770b\u73b0\u6709\u7248\u672c\u5143\u6570\u636e\uff0c\u53ea\u53d1\u73b0\u4e86\u5982\u4e0b\u65b9\u6848\u53ef\u4ee5\u5224\u65adROLE\u3002\u5982\u679c\u5bc6\u7801\u4e3a273A88CB37BFAB343D2A9DB9FAC9E15FE959B38A\uff0c\u5219\u4e3aROLE\u89d2\u8272\uff0c\u5426\u5219\u4e3a\u666e\u901a\u7528\u6237\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> select user from user where password='*273A88CB37BFAB343D2A9DB9FAC9E15FE959B38A';\r\n+----------------------------------------------------------------------------------------------------------------------------------+\r\n| user                                                                                                                             |\r\n+----------------------------------------------------------------------------------------------------------------------------------+\r\n| testrole                                                                                                                         |\r\n| testrole2                                                                                                                        |\r\n| testrole3                                                                                                                        |\r\n+----------------------------------------------------------------------------------------------------------------------------------+\r\n3 rows in set (Elapsed: 00:00:00.00)\r\n<\/code><\/pre>\n\n\n\n<p>ROLE\u89d2\u8272\u662f\u4e0d\u80fd\u4fee\u6539\u5bc6\u7801\u7684<\/p>\n\n\n\n<pre class=\"wp-block-code has-small-font-size\"><code>gbase> set password for testrole=password('1234');\r\nERROR 1758 (HY000): gcluster dal error: testrole is role.\r\ngbase>\r\n<\/code><\/pre>\n\n\n\n<p>\u800c\u6ca1\u6709\u5bc6\u7801\uff0c\u89d2\u8272\/role\u4e5f\u5c31\u65e0\u6cd5\u767b\u5f55\u4e86\u3002<\/p>","protected":false},"excerpt":{"rendered":"<p>\u5357\u5927\u901a\u7528GBase 8a\u652f\u6301\u7528\u6237\u7ec4\uff0c\u6216\u8005\u53eb\u7528\u6237\u89d2\u8272\u3002\u7528\u6237\u7ec4\u5185\u7684\u7528\u6237\uff0c\u81ea\u52a8\u62e5\u6709\u7ec4\u7684\u6743\u9650\uff0c\u53ef\u4ee5\u66f4\u9ad8\u6548\u7684\u6279\u91cf\u7ba1\u7406\u7528\u6237\u6743\u9650\u3002<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3],"tags":[76],"class_list":["post-2394","post","type-post","status-publish","format-standard","hentry","category-gbase8a","tag-76"],"_links":{"self":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2394","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/comments?post=2394"}],"version-history":[{"count":3,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2394\/revisions"}],"predecessor-version":[{"id":9991,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/posts\/2394\/revisions\/9991"}],"wp:attachment":[{"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/media?parent=2394"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/categories?post=2394"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.gbase8.cn\/en\/wp-json\/wp\/v2\/tags?post=2394"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}