psql -U homestead -h localhost -W
密码输入 secret
数据备份
pg_dump -h "homestead" -U 数据库名 -W -f 文件名 -d homestead -F c(文件类型)
如果选择text格式,需要使用psql命令
数据恢复
pg_restore不能恢复文本格式文件
pg_restore -d postgres(数据库名) /var/lib/postgresql/data/pgdata/你的文件名 -U postgres --clean --verbose
psql -d postgres -U postgres -f /var/lib/postgresql/data/pgdata/public202107.sql