Skip to main content

限制 User 登入來源

  • 因在工作剛好有遇到環境的資料庫有限制來源,剛好記錄一下,新增與 root 一樣的權限
grant all privileges on *.* to 'root'@'10.10.0.%' identified by 'passowd' with grant option max_queries_per_hour 0 max_connections_per_hour 0 max_updates_per_hour 0 max_user_connections 0;
flush privileges;
  • 修改某個資料庫來源限制
update db set Host=''10.10.0.%' where User='root';
flush privileges;
  • 指定某些帳號可以進那個資料表
# `XX\_%`.* 這是指定某些資料表名稱
GRANT SELECT, INSERT, UPDATE, DELETE, INDEX, ALTER, CREATE,CREATE VIEW,DROP,TRIGGER on `XX\_%`.*  TO [email protected].% IDENTIFIED BY 'passwd';
flush privileges;