After having installed your development environment you need to fill the database with content your Rails application can use. Please follow the instructions to import the database content of your live system into a local MySQL database:
- Log on to the source server as a user who is permitted to access the database.
- Run the following commands after having filled out the
parameters (such as database username, password, and target directory):
$ <span class='input'>mysqldump -h <em>MySQL-host</em> -u <em>MySQL-login</em> -p <em>DB-name</em> > dump.sql</span> Enter password: <span class='input'>MySQL-password</span>
In the example above, the database dump is stored as an uncompressed file,dump.sql, in the current directory. - Transfer the dump to the development host, for example by means of
scp(secure copy). - Import the dump into a new MySQL database. Here is an example of how this can be done:
development-host:~ $ <span class='input'>mysql -u root -p</span> Enter password: <span class='input'>MySQL-password</span> Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 275 Server version: 5.0.37 MySQL Community Server (GPL) Type 'help;' or '\h' for help. Type '\c' to clear the buffer. mysql> <span class='input'>create database railsdb;</span> Query OK, 1 row affected (0.00 sec) mysql> <span class='input'>grant all on railsdb.* to railsuser@localhost identified by 'railspassword';</span> Query OK, 0 rows affected (0.00 sec) mysql> <span class='input'>exit</span> Bye development-host:~ $ <span class='input'>mysql -u railsuser -prailspassword railsdb < dump.sql</span>
Hints
The database access credentials should be the same as in the Rails
database configuration
file (config/database.yml).