我看到很多关于此事的问题,我已经尝试了一切:
这是我的database.yml文件:
test:
adapter: mysql2
host: localhost
username: myname
password: mypassword
database: project-test
encoding: utf8
我已进入mysql,这是密码表:
mysql> use mysql
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> update user set password = PASSWORD('mypassword') where user = 'myname' and host = 'localhost';
Query OK, 1 row affected (0.00 sec)
Rows matched: 1 Changed: 1 Warnings: 0
mysql> select Host, User, Password from user;
+-----------+----------+-------------------------------------------+
| Host | User | Password |
+-----------+----------+-------------------------------------------+
| localhost | root | |
| rmv.local | root | |
| 127.0.0.1 | root | |
| localhost | | |
| rmv.local | | |
| localhost | myname | *D5CE3D8B65EF4DF67D9E8FD30184C66EF9DDEF29 |
+-----------+----------+-------------------------------------------+
但无论我得到什么:
bundle exec rake db:test:prepare
rake aborted!
Mysql2::Error: Access denied for user 'myname'@'localhost' (using password: YES)
答案 0 :(得分:0)
您必须为用户授予GRANT CREATE权限!就是这样!