grant all privileges on *.* to root@’192.168.2.%’ identified by ‘123456′;
*.*表示所有數(shù)據(jù)庫(kù)的所有表,只為test數(shù)據(jù)庫(kù)增加則改為test.*
root@’192.168.2.%’ 表示用戶名為root,可以自行更改,’192.168.2.%’是限制訪問的IP段
可單獨(dú)指定一個(gè)IP.如’192.168.2.165′ 也可以用于所有IP ‘%’
identified by ‘123456′; 訪問時(shí)的密碼
如果只想設(shè)置部分權(quán)限,如只有查詢和增加權(quán)限
grant select,create privileges on *.* to root@’192.168.2.%’ identified by ‘123456′;
權(quán)限一般有這幾種select,insert,update,delete,create,drop
mysql 的表類型更改
修改
alter table tablename change colaname newcolname integer not null
增加
alter table tablename add colname integer not null
刪除
alter table tablename drop colnum colname