美文网首页
复制postgres数据库

复制postgres数据库

作者: hjiangwen | 来源:发表于2017-09-22 10:36 被阅读33次

    Stack Overflow原文

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

    相关文章

      网友评论

          本文标题:复制postgres数据库

          本文链接:https://www.haomeiwen.com/subject/gvwxextx.html