MySQL錯誤:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

來源:互聯網
上載者:User

標籤:error 1221 (hy000): incorrect usage of db grant and global privileges

MySQL錯誤:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES
在執行MySQL複製的前奏時:為主伺服器建立使用者以便從伺服器串連,出現該錯誤:
GRANT REPLICATION SLAVE ON a_database.* to ‘repl‘@‘domain.test‘ IDENTIFIED BY ‘slavepass‘;
之所以指定資料庫我是希望能只複製這個資料庫而忽略其他(已建立的或今後會建立的)資料庫。
因為我還不知道MySQL可以在設定檔(/etc/my.cnf)中(或啟動時指定該參數)有一個專門的參數來指定資料庫:--replicate-do-db=資料庫名
引用:告訴從伺服器限制預設資料庫(由USE所選擇)為db_name的語句的複製。要指定多個資料庫,應多次使用該選項,每個資料庫使用一次。
來自MySQL5.1 manual 6.8節,更加詳細的說明參見這裡:
http://dev.mysql.com/doc/refman/5.1/zh/replication.html#replication-options

參考:http://forums.mysql.com/read.php?26,47781,47828#msg-47828

官方論壇上這個問題的主題:http://forums.mysql.com/read.php?26,47781,47781
還有:http://forums.admon.org/databases/6970-error-1221-hy000-incorrect-usage-db-grant-global-privileges.html

原因:是該許可權(REPLICATION SLAVE)是一個全域許可權(Global privilege),不能單獨指定給資料庫層級(database level)。
比如,FILE許可權不能授予給database level:
引用:It complains about that you are trying to use FILE privilege on a database level. And that is a Global privilege.
見:http://forums.devshed.com/mysql-help-4/error-1221-wrong-usage-of-db-grant-and-global-privileges-110852.html

SUPER許可權同樣適用:
見:http://webcache.googleusercontent.com/search?q=cache:http://systemadmin.es/2011/10/incorrect-usage-of-db-grant-and-global-privileges

EOF.最後的一個連結:
http://www.osgeo.org/files/fdo/docs/FET_TheEssentialFDO/files/WS1a9193826455f5ff9110c71085341391d-2981.htm

本文出自 “boyhack” 部落格,請務必保留此出處http://461205160.blog.51cto.com/274918/1748348

MySQL錯誤:ERROR 1221 (HY000): Incorrect usage of DB GRANT and GLOBAL PRIVILEGES

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.