我对此有点不知所措。我创建了 rails 应用程序,安装了 mysql 包并检查了我的 database.yml 文件。一切似乎都正确,但我无法登录 MYSQL。我试过mysql -u root。mysql -u 根 -p。mysqladmin -u 也是如此。任何指针将不胜感激。
我的错误看起来像。
mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
或者
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
数据库.yml
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MYSQL driver
# gem install mysql2
#
# Ensure the MySQL gem is defined in your Gemfile
# gem 'mysql2'
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8
reconnect: false
database: InterCambios_development
pool: 5
username: root
password:
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: InterCambios_test
pool: 5
username: root
password:
socket: /tmp/mysql.sock
production:
adapter: mysql2
encoding: utf8
reconnect: false
database: InterCambios_production
pool: 5
username: root
password:
socket: /tmp/mysql.sock