简体   繁体   English

我无法将MySQL数据库服务器与Rails项目连接? (Windows 7的)

[英]I cannot connect mysql database server with rails project? (Windows 7)

I am very new in rails and using windows 7. In my windows machine i ve installed ruby 1.93, rails 3.2, Mysql 5.1 properly (also Install the MYSQL driver using this command "gem install mysql2"). 我在Rails上使用Windows 7是一个非常新的人。在Windows机器上,我已经正确安装了ruby 1.93,rails 3.2,Mysql 5.1(也使用此命令“ gem install mysql2”安装MYSQL驱动程序)。 I also put "libmySQL.dll" file into ruby/bin directory. 我还将“ libmySQL.dll”文件放入ruby / bin目录。 I can create rails project and can run webrick server successfully..database server also get connected(using sqlite). 我可以创建Rails项目并可以成功运行Webrick服务器。数据库服务器也可以连接(使用sqlite)。 But when i use mysql using "rails new app_name -d mysql" this command....mysql server is not get connected with rails project. 但是,当我使用“ rails new app_name -d mysql”使用mysql时,此命令.... mysql服务器未与rails项目连接。 In my database.yml I have: 在我的database.yml中,我有:

development:
adapter: mysql2
encoding: utf8
reconnect: false
database: untitled5_development
pool: 5
username: root
password:
host: localhost

Sorry for my bad english. 对不起,我的英语不好。 Thanks everyone 感谢大家

Hi you have to set the password for the root user. 您好,您必须设置root用户的密码。 Also note that older versions of ruby on rails would expect you to comment the database name. 还要注意,旧版本的Rails会期望您注释数据库名称。 If you have not yet created the db. 如果尚未创建数据库。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM