grant错误,解释得详细的加分!
没学过数据库,照抄书上的.
mysql> grant all on depot_development.* to 'dave '@ 'localhost ';
这个句子是什么意思,为什么会导致出错?
ERROR 1133 (42000): Can 't find any matching row in the user table
上面这个是什么错误?
========
Enter password: *********
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 5.0.27-community-nt
Type 'help; ' or '\h ' for help. Type '\c ' to clear the buffer.
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| depot_development |
| depot_production |
| depot_test |
| mybook |
| mysql |
| test |
+--------------------+
7 rows in set (0.00 sec)
mysql> grant all on depot_development.* to 'dave '@ 'localhost ';
ERROR 1133 (42000): Can 't find any matching row in the user table
mysql> grant all on depot_test.* to 'dave '@ 'localhost ';
ERROR 1133 (42000): Can 't find any matching row in the user table
mysql> grant all on depot_production.* to 'prod '@ 'localhost ' identified by 'wibb
le ';
Query OK, 0 rows affected (0.00 sec)
------解决方案--------------------grant all privileges on depot_development.* to 'dave '@ 'localhost ';
------解决方案--------------------这是Rails敏捷Web开发那本书上的例吧.
你上面没有dave这个用户.
我是用
mysql> grant all on depot_development.* to 'root '@ 'localhost ';
就好了.
然后成功提示
Query OK.0 row affected (0.08sec)
------------------------------
qifanz┊Gmail.com
------解决方案--------------------grant all privileges(所有权限) on depot_development.*(在depot_development的所有表上) to 'dave '@ 'localhost '(用户)identified by '123456 '(用户密码:123456);