2016-03-24 143 views
0

我看到很多的问题,关于这个,我已经尝试了一切:无法创建轨测试数据库

这里是我的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

您必须授予用户权限!就是这样!