新手的postgreSQL笔记

环境变量

windows下安装postgreSQL后,把bin文件加入到环境变量

例如把E:\PostgreSQL\18\bin加入到Path的系统变量

本地登录

psql -h localhost -U postgres -d postgres -p 5432

按下回车后需输入密码,例如11111

备份远程数据至本地

方法1

复制代码
pg_dump   -h aws-1-ap-southeast-1.pooler.supabase.com   -U postgres.pxxxxxrkvjzavym   -d postgres   --schema=hghghg   --encoding=UTF8   --file=hghgxxxxup.sql
# ← 关键:用 --file,不用 > 重定向

方法2

复制代码
pg_dump "postgresql://postgres.pmxxxxxxavym:Zxxxxx45Pl@aws-1-ap-southeast-1.pooler.supabase.com:6543/postgres" --schema=hghghg  --file=hg888xup.sql

将本地sql还原至远程服务器

复制代码
psql "postgresql://postgres.pmbxxxxxym:Zxxxxxl@aws-1-ap-southeast-1.pooler.supabase.com:6543/postgres"   -c "DROP SCHEMA IF EXISTS hghghg CASCADE;"   -c "CREATE SCHEMA hghghg;"   -c "SET search_path TO hghghg;"   -f "hghghg_backup.sql"
相关推荐
m0_602857768 分钟前
如何提升SQL存储过程逻辑复用_封装通用存储过程函数
jvm·数据库·python
forEverPlume1 小时前
mysql如何实现高可用集群架构_基于MHA环境搭建与部署
jvm·数据库·python
草莓熊Lotso2 小时前
Vibe Coding 时代:LangChain 与 LangGraph 全链路解析
linux·运维·服务器·数据库·人工智能·mysql·langchain
三品吉他手会点灯7 小时前
C语言学习笔记 - 20.C编程预备计算机专业知识 - 变量为什么必须的初始化【重点】
c语言·笔记·学习
zh1570237 小时前
JavaScript中WorkerThreads解决服务端计算瓶颈
jvm·数据库·python
kobesdu8 小时前
【ROS2实战笔记-12】rosshow:终端里的盲文可视化与无头机器人的现场调试
笔记·机器人·ros·移动机器人
代码AI弗森8 小时前
一文理清楚“算力申请 / 成本测算 / 并发评估”
java·服务器·数据库
sakiko_8 小时前
UIKit学习笔记1-创建项目(使用UIKit)、使用组件
笔记·学习
Mr.朱鹏8 小时前
【Python 进阶 | 第四篇】Psycopg3 + Flask 实现 PostgreSQL CRUD 全流程:从连接池到RESTful接口
python·postgresql·flask·virtualenv·fastapi·pip·tornado
智者知已应修善业8 小时前
【51单片机中的打飞机设计】2023-8-25
c++·经验分享·笔记·算法·51单片机