標籤:
Mysql添加使用者
使用可以對mysql資料庫使用者表有操作許可權的使用者名稱登陸mysql
insert into user(Host,User,Password) values(‘%‘,‘name‘,‘password‘);
如果work使用者沒有登陸許可權,則
killall mysqld
share/mysql/mysql.server start
grant all on *.* to [email protected]‘%‘ identified by "password";
MySQL賦予使用者權限的命令的簡單格式為
grant 許可權 on 資料庫物件 to 使用者
grant 許可權 on 資料庫物件 to 使用者 identified by "密碼"
使用者名稱:ad,密碼:ad_pass,登陸ip:192.168.0.10
//使用者在所有登陸ip的許可權
grant all on *.* to [email protected]‘%’ identified by "ad_pass";
//開放管理MySQL中所有資料庫的許可權
grant all on *.* to [email protected]‘192.168.0.10‘ identified by "ad_pass";
//開放管理MySQL中具體資料庫(test)的許可權
grant all privileges on test to [email protected]‘192.168.0.10‘ identified by "ad_pass";
或
grant all on test to [email protected]‘192.168.0.10‘ identified by "ad_pass";
//開放管理MySQL中具體資料庫中的表(test.table1)的許可權
grant all on test.table1 to [email protected]‘192.168.0.10‘ identified by "ad_pass"
//開放管理MySQL中具體資料庫的表(test.table1)的部分列的許可權
grant select(id,se,rank) on test.table1 to [email protected]‘192.168.0.10‘ identified by "ad_pass";
//開放管理操作指令
grant select,insert,update,delete on test.* to [email protected]‘192.168.0.10‘ identified by "ad_pass";
//回收許可權
revoke all on *.* from [email protected];
//查看MySQL使用者權限
show grants;
show grants for [email protected];
mysql添加使用者和使用者權限