在 CentOS 中,“pgAdmin 如何导入”通常有三种常见理解,我分别说明,你可以对号入座:
如果你是 已经安装好 pgAdmin,想把 .sql 文件导入数据库:
.sql 文件psql -U username -d dbname -f /path/to/file.sql
例如:
psql -U postgres -d testdb -f /home/user/data.sql
sudo yum install -y https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/pgdg-redhat-repo-latest.noarch.rpm
sudo yum install -y pgadmin4
sudo /usr/pgadmin4/bin/setup-web.sh
按提示设置邮箱和密码。
访问:
http://服务器IP/pgadmin4
.dump 或自定义格式pg_restore -U postgres -d dbname /path/file.dump
psql -U postgres -d dbname -f file.sql
Peer authentication failed
解决:
sudo -u postgres psql
或修改 pg_hba.conf
导入前确认数据库编码:
SHOW client_encoding;
建议统一为 UTF8
如果你能具体说:
我可以给你更精确的命令。