我很难让 Ruby 连接到 mySQL。我可以让 MYSQL 使用 mySQL 工作台进行连接,这很好。这是我尝试运行 DBConsole 时遇到的错误。
W:\testMySQL>rails dbconsole
Enter password: ********
ERROR 1045 (28000): Access denied for user 'coffeetowndev'@'localhost' (using pa
ssword: YES)
我在 GoDaddy 帐户上的数据库上运行,因此我无法向该用户授予所有权限。我打电话给godaddy,他们发誓他们的“RoR”部门能够使用我的设置进行连接。说到这里,这里是database.yml文件。
development:
adapter: mysql
encoding: utf8
reconnect: false
port: 3306
database: coffeetowndev
pool: 5
username: coffeetowndev
password: ********
hostname: coffeetowndev.db.5850247.hostedresource.com
在相关/不相关的注释中,我无法安装 mySQL2 gem,所以我使用的是 mySQL。
编辑:整个 database.yml 文件
development:
adapter: mysql
encoding: utf8
reconnect: false
port: 3306
database: coffeetowndev
pool: 5
username: coffeetowndev
password: ********
hostname: coffeetowndev.db.5850247.hostedresource.com
test:
adapter: mysql
encoding: utf8
reconnect: false
port: 3306
database: coffeetowntest
pool: 5
username: coffeetowntest
password: ********
hostname: coffeetowntest.db.5850247.hostedresource.com
production:
adapter: mysql
encoding: utf8
reconnect: false
port: 3306
database: coffeetown
pool: 5
username: coffeetown
password: ********
hostname: coffeetown.db.5850247.hostedresource.com