開啟專案下的config/database.yml檔,將內容改成
development: adapter: mysql2 encoding: utf8 database: c9 host: <%=ENV['IP']%> username: <%=ENV['C9_USER']%> password: production: adapter: mysql2 encoding: utf8 database: c9 host: <%=ENV['IP']%> username: <%=ENV['C9_USER']%> password: test: adapter: mysql2 encoding: utf8 database: c9 host: <%=ENV['IP']%> username: <%=ENV['C9_USER']%> password:
再打開專案下的Gemfile(就是這一步,我一直再想what is gemfile???),增加兩行
# Use mysql as the database for Active Record gem 'mysql2'
接著在指令處下
gem install mysql2
安裝完成
Fetching: mysql2-0.3.19.gem (100%) Building native extensions. This could take a while... Successfully installed mysql2-0.3.19 1 gem installed
Run程式啦
rails s -b $IP -p $PORT
畫面可以正常出現就代表完成啦!
在連線請先確定是不是裝好mysql,才不會鬼打牆。
沒有留言:
張貼留言