PostgreSQL dump 文件导入:Ubuntu

记录如何将数据导入到 PostgreSQL

PSQL基本命令: https://www.jianshu.com/p/8515a02492f1

 ==========================

Found error:  psql: FATAL: Peer authentication failed for user "postgres"  https://stackoverflow.com/questions/18664074/getting-error-peer-authentication-failed-for-user-postgres-when-trying-to-ge

The problem is still your pg_hba.conf file (/etc/postgresql/10/main/pg_hba.conf*).

After altering this file, don't forget to restart your PostgreSQL server. If you're on Linux, that would be sudo service postgresql restart.

==========================

查询数据库------------

psql -U postgres -d gaia

select * from public."yourTablename" limit 10;

public is the schema of your table.

=========================

显示文件前3行:head -3 minicom.log

Use vim to modify the sql file : replace the schema with public

Copy the data: psql -U postgres -d gaia -f XXX.sql

你可能感兴趣的:(PostgreSQL dump 文件导入:Ubuntu)