授权: grant select,insert,update on dbname.tablename to username;对表都有了这些权限,该表下的列肯定也有这些权限了,不能对列只有查看权限.授予的权限可以分为多个层级 手册里有说明: 13.5. 数据库管理语句
grant select(列名) on dbname.tbname to user@'%' grant insert(列名) on dbname.tbname to user@'%' grant update(列名) on dbname.tbname to user@'%' grant delete(列名) on dbname.tbname to user@'%'
mysql> grant select,update,insert on xx.a to mablevi@localhost identified by '12 3456'; Query OK, 0 rows affected (0.00 sec)mysql> \q ByeC:\>mysql -umablevi -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 5 Server version: 5.1.40-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | xx | +--------------------+ 2 rows in set (0.02 sec)mysql> use xx; Database changed mysql> select * from xx.a; +----+------------+ | id | number | +----+------------+ | 1 | 1284024502 | | 2 | 3 | | 3 | 4 | | 4 | 5 | +----+------------+ 4 rows in set (0.06 sec)mysql> select * from xx.aa; ERROR 1142 (42000): SELECT command denied to user 'mablevi'@'localhost' for tabl e 'aa'
grant select,insert,update on dbname.tablename to username;对表都有了这些权限,该表下的列肯定也有这些权限了,不能对列只有查看权限.授予的权限可以分为多个层级
手册里有说明:
13.5. 数据库管理语句
grant insert(列名) on dbname.tbname to user@'%'
grant update(列名) on dbname.tbname to user@'%'
grant delete(列名) on dbname.tbname to user@'%'
我的全局:select
数据库:select
表:select,insert
列:部分表update,不成功
3456';
Query OK, 0 rows affected (0.00 sec)mysql> \q
ByeC:\>mysql -umablevi -p
Enter password: ******
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 5
Server version: 5.1.40-community-log MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| xx |
+--------------------+
2 rows in set (0.02 sec)mysql> use xx;
Database changed
mysql> select * from xx.a;
+----+------------+
| id | number |
+----+------------+
| 1 | 1284024502 |
| 2 | 3 |
| 3 | 4 |
| 4 | 5 |
+----+------------+
4 rows in set (0.06 sec)mysql> select * from xx.aa;
ERROR 1142 (42000): SELECT command denied to user 'mablevi'@'localhost' for tabl
e 'aa'
按照你这图的话,对数据库要有select.
第三张图勾选上select,update,insert 试下