Burada biraz şaşırdım. Bir veritabanı oluşturdum ve depot_production veritabanını kullanarak hiçbir sorunum olmadı. Ben tırmık testi ne zaman Ancak, son zamanlarda, ben garip şey benim database.yml dosyası iyi olduğunu düşünüyorum olduğunuMysql2 :: Hata: Kullanıcı 'test' @ 'localhost' veritabanı için 'depot_test' veritabanına erişim reddedildi
# Running tests:
EEEEEEEE
Finished tests in 0.031499s, 253.9763 tests/s, 0.0000 assertions/s.
1) Error:
test_should_create_product(ProductsControllerTest):
Mysql2::Error: Access denied for user 'test'@'localhost' to database 'depot_test'
gibi hataların bir demet olsun. Ve her zaman db'yi çalıştırıyorum: göç et, bana boş bir hat aldım. Ayrıca bir kullanıcı testi ekledim, ancak bunun sadece geliştirme veritabanına eklediğini düşünüyorum. Ben de böyle bir Herhangi bir tavsiye mutluluk duyacağız
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: depot_development
pool: 5
username: root
password: admin
socket: /tmp/mysql.sock
# Warning: The database defined as "test" will be erased and
# re-generated from your development database when you run "rake".
# Do not set this db to the same as development or production.
test:
adapter: mysql2
encoding: utf8
reconnect: false
database: depot_test
pool: 5
username: test
password: testy
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: depot_production
pool: 5
username: prod
password: mypassword
socket: /tmp/mysql.sock
, teşekkürler ... benim test ve üretim ve veritabanları yoktur düşünüyorum.
Buraya yapıştığınız için teşekkür ederiz. Yakın olduğumu hissediyorum ama bir şey tuhaf. İşte yaptım. Kök kullanıcı terminalinden denir köküne ya da her türlü şekilde
mysql> use depot_test;
ERROR 1049 (42000): Unknown database 'depot_test'
mysql> show databases;
+--------------------+
| Database |
+--------------------+
| information_schema |
| depot_development |
| development |
| mysql |
| performance_schema |
| test |
+--------------------+
6 rows in set (0.01 sec)
mysql> use depot_test
ERROR 1049 (42000): Unknown database 'depot_test'
mysql> use test
Database changed
mysql> GRANT SELECT, INSERT, DELETE ON `test` TO [email protected]'localhost' IDENTIFIED BY 'testy';
ERROR 1146 (42S02): Table 'test.test' doesn't exist
mysql> GRANT SELECT, INSERT, DELETE ON `depot_test` TO [email protected]'localhost' IDENTIFIED BY 'testy';
ERROR 1146 (42S02): Table 'test.depot_test' doesn't exist
"depot_test" öğesini değiştirmek için "test" kullanıcısına izinler vermeniz gerekiyor – 1337holiday