因为你的授权表中一定还存在有+-----------------+--------------+--------------------
| Host | User | Password
+-----------------+--------------+--------------------
| localhost | ....
+-----------------+--------------+--------------------这样的用户信息,当你以 mysql -h localhost -u root 登录时,
它先匹配的是这个用户授权信息,
而不是
Host = % User = tsm
| Host | User | Password
+-----------------+--------------+--------------------
| localhost | ....
+-----------------+--------------+--------------------这样的用户信息,当你以 mysql -h localhost -u root 登录时,
它先匹配的是这个用户授权信息,
而不是
Host = % User = tsm
解决方案 »
- 如何修改windows版的mysql的密码
- 报表界面,参数输入如何控制
- mysql 触发器怎么写
- mysql query if empty?
- 发现 /etc/init.d /mysqld start -----------是失败的 无法启动
- 数据库内表过多,会有什么影响?
- 数据库设计问题。崩溃ING...
- c# mysql
- 大学专科,精通php&MYsql编程,网页制作,网站设计;vb,pb因为开课的关系,也比较熟悉,精通win2000组网,并有两年的硬件维护和网络维护经验!而且现在我准备考scjp了!(应该会过),可是要找工作,反而迷茫了,我要找什么工作?
- 求助:mysql两个表的比对问题
- 用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>