1.切换到postgres用户 : sudo su - postgres
2.psql进入postgresql命令行
3.create database createdbxxx
4. Ctrl+Z退出postgresql命令行
5. 恢复数据库: pg_restore -d xxx(上述创建的数据库) backup_filepath(备份文件路径)
参考链接:
http://www.ruanyifeng.com/blog/2013/12/getting_started_with_postgresql.html
https://codeday.me/bug/20180824/228265.html