12月 16, 2010

MySQL IP限制筆記

// 顯示資料庫
show databases;

// 選擇 mysql db
use mysql;

// 顯示 user 權限
show grants for username;

// 開啟mysql db 連線的ip
grant all on dbname.* to ‘username’@'localhost’ identified by ‘password’;
grant all on dbname.* to ‘username’@'ip’ identified by ‘password’;

// 顯示目前帳戶@ip 資訊
show grants for username@ip;

// 更新權限
flush privileges;