Warning: This setup can be dangerous if you forget which environment you are in you can cause damage to your LIVE environment.
Login to postgres as a superuser and use \l to list your databases
me@lsmbbox:~$ psql -U ledgersmb -h localhost
Password for user ledgersmb:
Welcome to psql 8.3.8, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
ledgersmb=> \l
List of databases
Name | Owner | Encoding
------------------+-----------+----------
jmits-5zero-live | ledgersmb | UTF8
ledgersmb | ledgersmb | UTF8
postgres | postgres | UTF8
template0 | postgres | UTF8
template1 | postgres | UTF8
(5 rows)
\q
Identify your ledgersmb database. Mine is jmits-5zero-live
backup your live DB using pg_dump
me@lsmbbox:~$ pg_dump -U ledgersmb -h localhost jmits-5zero-live > jmits-5zero-live.sql
Create a new test database
createdb -T ledgersmb jmits-5zero-test
Restore you live backup into the test db
psql -U ledgersmb -h localhost jmits-5zero-test < jmits-5zero-live.sql
Goto the ledgersmb admin page and login
http://
Configure your user account to use the test db
Always check your environment when logging in to LedgerSMB and clicking the Version Link in the left hand side to display your DB environment:
0 Comments