有二种方法:
1: 执行psql -h myhost -d template1 -U postgres
登陆成功后,用命令 \c mydb2即可切换到mydb22: 直接执行psql -h myhost -d mydb2 -U postgres
1: 执行psql -h myhost -d template1 -U postgres
登陆成功后,用命令 \c mydb2即可切换到mydb22: 直接执行psql -h myhost -d mydb2 -U postgres
# TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD
local all all trust
# IPv4-style local connections:
host all all 127.0.0.1 0.0.0.0 trust
# IPv6-style local connections:
host all all 0.0.0.0 0.0.0.0 md5
对本机全信任的,对远程连接的需要密码验证。你本机操作自己的数据库,不要用-h host的远程连接方式。启动数据库你可以以postgres的身份进入命令行的,在开始--运行里:runas /user:postgres cmd
然后可以postmaster命令启动数据库
# TYPE DATABASE USER CIDR-ADDRESS METHOD# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 md5
这样行吗?
# TYPE DATABASE USER CIDR-ADDRESS METHOD
local all all trust # IPv4 local connections:
host all all 127.0.0.1/32 trust
# IPv6 local connections:
host all all 0.0.0.0/32 md5
(trampwind)给的范例了。是不是直接将最后那一行去掉就行了呢?
-------------------------------------------------------------
# TYPE DATABASE USER CIDR-ADDRESS METHOD# IPv4 local connections:
host all all 127.0.0.1/32 md5
# IPv6 local connections:
#host all all ::1/128 md5没出现过任何问题
mydb2=#\d weather;
'more'不是内部或外部命令,也不是可运行的程序或批处理文件。
而且我想查我所创建的表:weather:
mydb2=#select * from weather; 所显示的信息和上面一样,这是怎么一回事呀?我在Unix/linux上没有这种提示信息。