MySQL社区

 找回密码
 注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

搜索
查看: 2164|回复: 1
打印 上一主题 下一主题

关于mysql用户权限问题

[复制链接]
跳转到指定楼层
1#
发表于 2013-3-26 11:52:57 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
刚刚接触mysql,在看了书之后,对于权限有一个问题。
在新建了一个用户后,没有赋予任何权限,但是这个用户为什么就能查询其它数据库的表数据呢?
还是我理解有问题呢?

--创建新用户
[root@gc ~]# mysql -uroot -proot
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 47
Server version: 5.5.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create user lcz@localhost identified by 'lcz';
Query OK, 0 rows affected (0.02 sec)
mysql> show grants for lcz@localhost;
+------------------------------------------------------------------------------------------------------------+
| Grants for lcz@localhost                                                                                   |
+------------------------------------------------------------------------------------------------------------+
| GRANT USAGE ON *.* TO 'lcz'@'localhost' IDENTIFIED BY PASSWORD '*A1238F347489C1C8313C8BC039B6C6B1E00A6640' |
+------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql> exit
Bye

--用新用户登录
[root@gc ~]# mysql -ulcz -plcz
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 48
Server version: 5.5.24 MySQL Community Server (GPL)
Copyright (c) 2000, 2011, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
--此时就能查到其它数据库表数据
mysql> select count(1) from sqoop.tb1;
+----------+
| count(1) |
+----------+
|       93 |
+----------+
1 row in set (0.00 sec)
mysql> create table test.t1 as select * from sqoop.tb1;
Query OK, 93 rows affected (0.16 sec)
Records: 93  Duplicates: 0  Warnings: 0

分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友 微信微信
收藏收藏 分享淘帖 顶 踩
2#
发表于 2013-3-26 17:23:34 | 只看该作者
应该是你弄错了。还奇怪呢,我这里还试了试,没有问题。
mysql -ulcz -plcz进入后用shou grants 看看权限。如果还是USAGE,那么就什么都不能做。

可以在用show databases; show tables;命令试试...
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|申请友链|小黑屋|Archiver|手机版|MySQL社区 ( 京ICP备07012489号   
联系人:周生; 联系电话:13911732319

GMT+8, 2024-4-25 20:48 , Processed in 0.064385 second(s), 22 queries , Gzip On.

Powered by Discuz! X3.2

© 2001-2013 Comsenz Inc.

快速回复 返回顶部 返回列表