简体   繁体   English

我无法通过RoR访问自己的MySQL服务器?

[英]I can not get access to my own MySQL server via RoR?

Okay, so I'm new to ruby and today I spent all day installing it and necessary gems...then uninstalled it and installed everything using RubyInstaller. 好的,所以我是ruby的新手,今天我花了一整天安装它和必要的宝石......然后卸载它并使用RubyInstaller安装所有东西。

Anyway, everything is fine with my installation I think... 无论如何,我想我的装置一切都很好......

I also installed MySQL, and when start WEBrick like this rails server But when I load up localhost:3000 我也安装了MySQL,当启动WEBrick时就像这个rails服务器但是当我加载localhost:3000时

I get this message: Access denied for user 'root'@'localhost' (using password: NO) 我收到此消息:用户'root'@'localhost'拒绝访问(使用密码:否)

If your root user doesnt have a password in your sql server, you should add a blank in your database.yml file: 如果root用户在sql server中没有密码,则应在database.yml文件中添加一个空格:

development:
  ...
  username: root
  password: ""

If your root user in the sql server has a password (probably yes), you should specify it in your database.yml 如果sql server中的root用户有密码(可能是),则应在database.yml中指定

development:
  ...
  username: root
  password: pa$$word

EDIT: 编辑:

For creating the database run 用于创建数据库运行

bundle exec rake db:create
bundle exec rake db:migrate

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

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