mysql> grant select on foo.* to foo2@localhost identified by '1234'; Query OK, 0 rows affected (0.00 sec)mysql> flush privileges; Query OK, 0 rows affected (0.00 sec)
create database testdb; -- 先赋予用户对testdb库下所有权限,然后一个个移出楼主禁止其操作的权限-- 建用户的时候赋予权限,用户名为feng,密码123456,只能以localhost的主机登录。 grant all on testdb.* to 'feng'@'localhost' identified by '123456';-- 移去删除表、库的权限 revoke drop on testdb.* from 'feng'@'localhost' ; -- 移去删除表数据的权限 revoke delete on testdb.* from 'feng'@'localhost' ;-- 有一点疑问,楼主的查看和管理,一般的管理,我理解为对数据库的所有操作, -- 后面楼主禁止删除,我就移去这2项功能,不知道我的理解对不对,不对的地方楼主再说出来,反正建用户赋予权限,收回权限的例子如上所示。
create database testdb;-- 先赋予用户对testdb库下所有权限,然后一个个移出楼主禁止其操作的权限-- 建用户的时候赋予权限,用户名为feng,密码123456,只能以localhost的主机登录。 grant all on testdb.* to 'feng'@'localhost' identified by '123456';-- 移去删除表、库的权限 revoke drop on testdb.* from 'feng'@'localhost' ; -- 移去删除表数据的权限 revoke delete on testdb.* from 'feng'@'localhost' ;-- 有一点疑问,楼主的查看和管理,一般的管理,我理解为对数据库的所有操作, -- 后面楼主禁止删除,我就移去这2项功能,不知道我的理解对不对,不对的地方楼主再说出来, -- 反正建用户赋予权限,收回权限的例子如上所示。
grant select on testdb.* username@localhost identified by 'password'; 上面是是建立username帐号,密码为password,只可以查看testdb库下面所有表的信息; 不知道楼主的管理 是需要那些?
grant select on testdb.* to feng11@localhost;
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
create database testdb;
-- 先赋予用户对testdb库下所有权限,然后一个个移出楼主禁止其操作的权限-- 建用户的时候赋予权限,用户名为feng,密码123456,只能以localhost的主机登录。
grant all on testdb.* to 'feng'@'localhost' identified by '123456';-- 移去删除表、库的权限
revoke drop on testdb.* from 'feng'@'localhost' ;
-- 移去删除表数据的权限
revoke delete on testdb.* from 'feng'@'localhost' ;-- 有一点疑问,楼主的查看和管理,一般的管理,我理解为对数据库的所有操作,
-- 后面楼主禁止删除,我就移去这2项功能,不知道我的理解对不对,不对的地方楼主再说出来,反正建用户赋予权限,收回权限的例子如上所示。
grant all on testdb.* to 'feng'@'localhost' identified by '123456';-- 移去删除表、库的权限
revoke drop on testdb.* from 'feng'@'localhost' ;
-- 移去删除表数据的权限
revoke delete on testdb.* from 'feng'@'localhost' ;-- 有一点疑问,楼主的查看和管理,一般的管理,我理解为对数据库的所有操作,
-- 后面楼主禁止删除,我就移去这2项功能,不知道我的理解对不对,不对的地方楼主再说出来,
-- 反正建用户赋予权限,收回权限的例子如上所示。
grant select on testdb.* username@localhost identified by 'password';
上面是是建立username帐号,密码为password,只可以查看testdb库下面所有表的信息;
不知道楼主的管理 是需要那些?