Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- In addition to installing the MySQL database, you will also need to add the
- mysql gem to the Gemfile:
- Download depot_t/Gemfile
- group :production do
- gem 'mysql'
- end
- By putting this gem in group production, it will not be loaded when running
- in development or test. If you like, you can put sqlite3 gem into (separate)
- development and test groups.
- Install the gem using bundle install. You may need to locate and install the
- MySQL database development files for your operating system first. On Ubuntu,
- for example, you will need to install libmysqlclient-dev.
- You can use the mysql command-line client to create your database, or if you’re
- more comfortable with tools such as phpmyadmin or CocoaMySQL, go for it:
- depot> mysql -u root
- mysql> CREATE DATABASE depot_production;
- mysql> GRANT ALL PRIVILEGES ON depot_production.*
- -> TO 'username'@'localhost' IDENTIFIED BY 'password';
- mysql> EXIT;
- If you picked a different database name, remember it, because you will need to
- adjust the configuration file to match the name you picked. Let’s look at that
- configuration file now.
- The database.yml contains information on database connections. It contains
- three sections, one each for the development, test, and production databases.
- The current production section contains the following:
- production:
- adapter: sqlite3
- database: db/production.sqlite3
- pool: 5
- timeout: 5000
- We replace that section with something like the following:
- production:
- adapter: mysql
- encoding: utf8
- reconnect: false
- database: depot_production
- pool: 5
- username: username
- password: password
- host: localhost
- Change the username, password, and database fields as necessary.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement