sudo -u postgres psql #进入postgresql ALTER USER postgres WITH password ‘postgres‘; #修改postgres用户密码 psql -h 192.168.68.17 -p 5432 -U cmdbuild #远程连接命令 create user cmdbuild with password ‘cmdbuild‘; #创建cmdbuild用户,密码为cmdbuild create database cmdbuild owner cmdbuild; #创建数据库cmdbuild,拥有作者为cmdbuild grant all privileges on database cmdbuild to cmdbuild; #授权 SELECT datname FROM pg_database; #查看所有数据库 \c 数据库名 #切换指定数据库 select * from pg_tables; #获取当前db中所有表的信息 psql -U cmdbuild -W -d cmdbuild -f *.sql #导入sql文件 psql -d cmdbuild -h 192.168.68.17 -p 5432 -U cmdbuild -f *.sql #导入sql文件 select * from pg_roles; #查看用户权限 ALTER ROLE cmdbuild WITH CREATEROLE; #为用户添加CEEATEROLE权限 \q或者control+d离开
如果报FATAL: Peer authentication failed for user "postgres" 解决方法
https://blog.csdn.net/liyazhen2011/article/details/88977424
原文地址:https://www.cnblogs.com/biaopei/p/12074258.html
时间: 2024-10-15 08:34:45