Database Configuration
Radiant currently supports MySQL, PostgreSQL, and SQLite, and may also work with other Rails databases. To get started create the following databases:
- radiant_dev
- radiant_test
- radiant_production
MySQL
create database radiant_dev;
create database radiant_test;
create database radiant_production;
grant all on radiant_dev.* to u@'%' identified by 'pw';
grant all on radiant_test.* to u@'%' identified by 'pw';
grant all on radiant_production.* to u@'%' identified by 'pw';
flush privileges;
Where `u` is the username and `pw` the password. You’ll need to put these values in `config/database.yml`.
Your `database.yml` should look similar to this:
development:
adapter: mysql
database: radiant_dev
username: replace-with-your-username
password: replace-with-your-password
socket: /tmp/mysql.sock
test:
adapter: mysql
database: radiant_test
username: replace-with-your-username
password: replace-with-your-password
socket: /tmp/mysql.sock
production:
adapter: mysql
database: radiant_production
username: replace-with-your-username
password: replace-with-your-password
socket: /tmp/mysql.sock
PostgreSQL
First, you need to install postgres gem
sudo gem install postgres
If you installed postgresql on a location other than the default, as when installing via macports on Mac OS X, you need to tell gem where to find it
sudo gem install postgres -- --with-pgsql-include=/opt/local/include/postgresql81 --with-pgsql-lib=/opt/local/lib/postgresql81
The config/database.yml should look something like this
development:
adapter: postgresql
database: radiant_dev
username: <username>
password: <password>
host: <hostname or ip address. eg.: localhost>
test:
adapter: postgresql
database: radiant_test
username: <username>
password: <password>
host: <hostname or ip address. eg.: localhost>
production:
adapter: postgresql
database: radiant_live
username: <username>
password: <password>
host: <hostname or ip address. eg.: localhost>
SQLite
If you want to use SQLite all you’ll have to do is create your `config/database.yml` since the SQLite db files will be created when you run the setup script.
development:
adapter: sqlite3
database: db/radiant_dev.sqlite.db
test:
adapter: sqlite3
database: db/radiant_test.sqlite.db
production:
adapter: sqlite3
database: db/radiant_live.sqlite.db
Important:
# UNIX and Mac OS X systems must have swig installed before installing the sqlite-ruby or sqlite3-ruby gem. Otherwise the gem will not use the actual sqlite library, instead defaulting to a pure ruby that doesn’t work properly (random errors, crashes, memory leaks). Make sure that you include Ruby bindings in swig (e.g., darwinports/macports default config is fine. On Gentoo: USE="ruby" emerge swig or better yet add the line dev-lang/swig ruby to /etc/portage/package.use). Bottom line, you need to see some compilation during installation of the sqlite gem.
# In order for Archive Index behaviors to work you need to patch archive_finder.rb (as of Radiant 0.5.2). See ticket:257 for details.
# There is an incompatibility between Rails < 1.2.3 and sqlite3 < 3.3.17 on all platforms. Please update at least to Radiant 0.6.1 (which includes the latest Rails in the ‘vendor’ directory) and to sqlite3 3.3.17. See http://weblog.rubyonrails.com/2007/1/29/using-sqlite3-with-rails and http://lists.radiantcms.org/pipermail/radiant/2007-June/005302.html.
