MySQL grant all privileges

กันลืม จะใช้ทีไรลืมตลอด จำไม่ได้แล้วก็มานั่งหา เอามาเก็บไว้เลย
 

#grant all privileges on database_name.* to username@localhost identified by'password';

#flush privileges;


อนุญาติบาง Group IP address
 #grant all privileges on *.* to 'user'@'192.168.1.%' identified by 'password';
#flush privileges;

อนุญาติบาง databases บาง Group IP address
#grant all privileges on Some-db.* to 'user'@'192.168.1.%' identified by 'password';
#flush privileges;

ถ้าอยากให้connectจากที่อื่นได้เปลี่ยนจาก localhostเป็น%ก็จะได้เป็นusername@'%'

#grant all privileges on dbname.* to username@'%' identified by 'password';



แล้วก็ถ้าสมมติว่าจะเอาuserนี้ออกไม่ให้ connectdatabase

#revoke all on database_name.* from username@localhost;

Credit ตัวเอง http://tudtu25.exteen.com/20100304/mysql-grant-all-privileges

Comments