grant all privileges on *.* to root@’192.168.2.%’ identified by ‘123456′;
*.*表示所有數據庫的所有表,只為test數據庫增加則改為test.*
root@’192.168.2.%’ 表示用戶名為root,可以自行更改,’192.168.2.%’是限制訪問的IP段
可單獨指定一個IP.如’192.168.2.165′ 也可以用于所有IP ‘%’
identified by ‘123456′; 訪問時的密碼
如果只想設置部分權限,如只有查詢和增加權限
grant select,create privileges on *.* to root@’192.168.2.%’ identified by ‘123456′;
權限一般有這幾種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