Search code examples
mysqlruby-on-railsrubyshared-hosting

How can I configure database.yml from an existing database on bluehost?


I already have a database and a user/password that I create from cPanel "MySQL Wizard", but I'm having problems while configuring the database.yml file. I don't know how it should look like.

When I created my app on my computer to run on localhost:3000, only running the "rake db:create" command made everything works, but now that I have a database that was created before the app, I don't know how can I configure it.

I tried to read the some rubyonrails.org guides, but it didn't help me.


Solution

  • A Rails database.yml for a MySQL database usually looks like this:

    development:
      adapter: mysql2
      encoding: utf8
      database: blog_development
      pool: 5
      username: root
      password:
      socket: /tmp/mysql.sock
    

    Just add your configuration for your environment following the same structure: