我现在想把mysql的数据库里的几个表对外公开,让其他人来访问使用,通过给出的数据库接口远程登录到这个数据库里来,然后指定权限,只能操作这个数据库里的指定的数据表,如:这个数据库名为BBXT,它里面有几十个表,但是只有a,b这两个表是对外远程访问的,这外远程访问可以通过MySQL-Front软件远程登录,那么应该如何来设置这个用户的访问权限呢?请高手们指点一二.谢谢!
调试欢乐多
to 要授权的用户名@"%"(%表示所有的IP,可以只些一个IP)identified by "密码";
mysql> create database c_t;
Query OK, 1 row affected (0.28 sec)mysql> use c_t;
Database changed
mysql> show tables;
Empty set (0.00 sec)mysql> create table a(id int not null);
Query OK, 0 rows affected (0.00 sec)mysql> create table b(id int not null);
Query OK, 0 rows affected (0.00 sec)mysql> create table c(id int not null);
Query OK, 0 rows affected (0.01 sec)mysql> create table d(id int not null);
Query OK, 0 rows affected (0.00 sec)mysql> show tables;
+---------------+
| Tables_in_c_t |
+---------------+
| a |
| b |
| c |
| d |
+---------------+
4 rows in set (0.00 sec)
mysql> grant all privileges on c_t.a to webuser@'%' identified by '123456';
Query OK, 0 rows affected (0.00 sec)mysql> grant all privileges on c_t.b to webuser@'%';
Query OK, 0 rows affected (0.00 sec)mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)mysql> \q
Bye
[root@localhost ~]# mysql -uwebuser -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 28230
Server version: 5.1.21-beta MySQL Community Server (GPL)Type 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> use c_t;
Database changed
mysql> show tables;
+---------------+
| Tables_in_c_t |
+---------------+
| a |
| b |
+---------------+
2 rows in set (0.00 sec)