因为你的授权表中一定还存在有+-----------------+--------------+--------------------
| Host | User | Password
+-----------------+--------------+--------------------
| localhost | ....
+-----------------+--------------+--------------------这样的用户信息,当你以 mysql -h localhost -u root 登录时,
它先匹配的是这个用户授权信息,
而不是
Host = % User = tsm
| Host | User | Password
+-----------------+--------------+--------------------
| localhost | ....
+-----------------+--------------+--------------------这样的用户信息,当你以 mysql -h localhost -u root 登录时,
它先匹配的是这个用户授权信息,
而不是
Host = % User = tsm
解决方案 »
- 合区并筛选
- 3-4位字符串,用char(4)好还是var(4)呢?
- 如何查询这些带有特殊符号的数据?
- 要求:写一个表数据导出成文本再进行比较
- 发起一个翻译计划:将SQLite3文档译为中文
- myeclipse的dbbrower下以及mysql5.0的可视化工具打开表报内存不能读?
- FOUND_ROWS()总是返回1
- 大家好,我创建了一个群2677057,希望大家多多支持。
- 如何备份和恢复innodb类型的表?直接拷贝数据库文件可以吗?
- 请帮忙看一下“查询表A中的手机号不出现在表B中的记录”超级慢的问题
- 用mysql的odbc和c++ API那个好?有什么区别
- 请教通过linux odbc/myodbc 连接mysql 数据库问题!
一定是你的操作上有问题了,看我的操作全过程
Microsoft Windows 2000 [Version 5.00.2195]
(C) 版权所有 1985-2000 Microsoft Corp.================= 此处开始以 root 身份登录C:\>mysql -h localhost -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2 to server version: 4.0.13-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.================= 此处建立一个对 test 库有所有权限(包括GRANT)的用户 WXQmysql> GRANT ALL ON test.* TO WXQ@'localhost' WITH GRANT OPTION;
Query OK, 0 rows affected (0.00 sec)================= 此处建立一个对 test 库只有SELECT权限的用户 WXQ2mysql> GRANT SELECT ON test.* TO WXQ2@'localhost';
Query OK, 0 rows affected (0.00 sec)================= 此处验证用户建立是否成功mysql> SELECT Host,Db,User,Select_priv AS S,Insert_priv AS I,Update_priv AS U
-> FROM mysql.db;
+-----------+------+------+---+---+---+
| Host | Db | User | S | I | U |
+-----------+------+------+---+---+---+
| localhost | test | WXQ | Y | Y | Y |
| localhost | test | WXQ2 | Y | N | N |
+-----------+------+------+---+---+---+
2 rows in set (0.00 sec)================= 此处退出连接,然后以用户 WXQ 登录mysql> exit
ByeC:\>mysql -h localhost -u WXQ
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 13 to server version: 4.0.13-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.================= 此处验证当前连接用户的身份mysql> SELECT USER();
+---------------+
| USER() |
+---------------+
| WXQ@localhost |
+---------------+
1 row in set (0.00 sec)================= 此处将 WXQ 对 test 库的所有权限授权给 WXQ2 (除 GRANT)mysql> GRANT ALL ON test.* TO WXQ2@'localhost';
Query OK, 0 rows affected (0.00 sec)================= 此处退出连接,然后以用户 root 登录,这是为了查看 mysql.db 表信息mysql> exit;
ByeC:\>mysql -h localhost -u root
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 15 to server version: 4.0.13-nt-logType 'help;' or '\h' for help. Type '\c' to clear the buffer.mysql> SELECT Host,Db,User,Select_priv AS S,Insert_priv AS I,Update_priv AS U
-> FROM mysql.db;
+-----------+------+------+---+---+---+
| Host | Db | User | S | I | U |
+-----------+------+------+---+---+---+
| localhost | test | WXQ | Y | Y | Y |
| localhost | test | WXQ2 | Y | Y | Y |
+-----------+------+------+---+---+---+
2 rows in set (0.00 sec)mysql>