- 登录postgres账号,
postgres
是我的账号名,我想复制的数据库是用该账号创建的
$ sudo -i -u postgres
- 复制,将数据库信息导出到
the_backup.sql
文件
$ pg_dump the_db_name > the_backup.sql
- 然后恢复,将
the_backup.sql
数据库信息导入其他数据库
$ psql the_new_dev_db < the_backup.sql
postgres
是我的账号名,我想复制的数据库是用该账号创建的$ sudo -i -u postgres
the_backup.sql
文件$ pg_dump the_db_name > the_backup.sql
the_backup.sql
数据库信息导入其他数据库$ psql the_new_dev_db < the_backup.sql