[root@jeven ~]# psql -h192.168.3.166 -Upostgres -WPassword:psql: error: FATAL: password authentication...failed for user "postgres"三、分析原因分析以下可能原因,进行逐一排查。...su - postgrespsql -c " ALTER USER postgres WITH PASSWORD 'postgres';"5.2 密码设置错误或未设置数据库的密码设置错误或未设置,在连接到本地服务后...sudo -u postgrespsql -c " ALTER USER postgres WITH PASSWORD 'postgres';"5.3 配置文件出错当配置文件出错,尝试以下修改。
PASSWORD 'password'设置角色的口令。如果没有计划使用口令认证则可以省略这个选项。如果没有指定口令,口令将被设置为空并且该用户的口令认证总是会失败。...角色特殊属性 创建用户,观察角色属性: postgres=# CREATE USER gp_dy WITH PASSWORD 'gp_dy'; NOTICE: resource queue required...现在我们切回管理员用户,将数据库的CREATE权限赋予用户: [gpadmincloud@mdw-snova-aqfhzkhe ~]$ psql -d postgres psql (9.4.24) Type...TO super_dy; SET dy_demo=> CREATE TABLE dy_test(id int, name varchar) DISTRIBUTED BY (id); CREATE TABLE...search_path TO super_dy; SET dy_demo=# CREATE TABLE super_test(id int, name varchar) DISTRIBUTED BY
测试: [postgres@abc ~]$ psql Password for user postgres: psql (11.2) Type "help" for help....Password for user lanshan1: psql (11.2) Type "help" for help....Password for user lanshan2: psql: FATAL: role "lanshan2" is not permitted to log in postgres=# CREATE...[postgres@abc data]$ psql Password for user postgres: psql: FATAL: password authentication failed...for user "postgres" [postgres@abc data]$ psql Password for user postgres: psql (11.2) Type "help"
测试: [postgres@abc ~]$ psql Password for user postgres: psql (11.2) Type "help" for help. postgres=#...Password for user lanshan2: psql: FATAL: role "lanshan2" is not permitted to log in postgres=# CREATE...-Ulss -dpgtest Password for user lss: psql (11.2) Type "help" for help. pgtest=# 如果超级用户忘记密码怎办?...[postgres@abc data]$ psql Password for user postgres: psql: FATAL: password authentication failed for...user "postgres" [postgres@abc data]$ psql Password for user postgres: psql (11.2) Type "help" for help
我打开psql,登陆如下界面: ? 按照说明文档中使用createdb命令创建数据库,但是提示语法错误。...后来我就只能使用SQL语句进行创建了create database newDB,OK,创建成功。...tablename PostgreSQL: \d+ tablename (6)退出登录 MySQL: quit 或者\q PostgreSQL:\q (7)修改密码 PostgreSQL: alter user... postgres with password 'new password'; (8)查看所有用户 PostgreSQL: select * from pg_roles; (9)查看表空间(tablespace
下面的命令将cdc_user用户/角色创建为超级用户: -- Create cdc_user as a superuser CREATE ROLE cdc_user WITH SUPERUSER CREATEDB...以下命令将cdc_user用户/角色创建为超级用户: -- Create cdc_user user with only LOGIN and REPLICATION privileges CREATE...ROLE cdc_user WITH REPLICATION LOGIN PASSWORD 'supersecret1'; -- Grant privileges on the cdc_test database...psql --host localhost --port 5432 --username cdc_user cdc_test 连接后,您应该会看到psql带有数据库名称的提示,如下所示: cdc_test...', 'hostname' = '', 'username' = 'cdc_user', 'password' = 'supersecret1', 'database-name
postgres=# alter user postgres with password '123456'; 这样,管理员"postgres"的密码就为"123456"。...运行系统用户"postgres"的psql命令,进入客户端: sudo -u postgres psql 创建用户"xiaozhang"并设置密码: postgres=# create user xiaozhang...with password '123456'; 创建数据库exampledb,所有者为xiaozhang: postgres=# create database exampledb owner xiaozhang...: zsm@ubuntu:~$ sudo -u postgres psql psql (9.5.3) Type "help" for help. postgres=# \password xiaozhang1...六、基本数据库操作命令 # 创建新表 CREATE TABLE user_tbl(name VARCHAR(20), signup_date DATE); # 插入数据 INSERT INTO user_tbl
-U user1 -d chinadaas Password for user user1: psql (8.3.23) Type "help" for help. chinadaas=> 11.2.1.3...; DROP ROLE 11.2.1.3.1.2 查看撤销效果 $ psql -h 192.168.***.55 -U user2 -d auth_test Password for user user2...: psql: FATAL: password authentication failed for user "user2" 11.2.1.3.2 删除授数据库的用户 11.2.1.3.2.1 撤销权限...-h 192.168.***.55 -U user1 -d auth_test Password for user user1: psql: FATAL: password authentication...GP怕多用户操作混乱 11.2.3.2 创建USER2 # create role user2 with login password '123456'; NOTICE: resource queue
此时命令行会显示 root@xsl:~# su - postgres postgres@xsl:~$ psql psql (9.4.6) Type "help" for help....postgres=# 修改postgres用户的密码 postgres=# \password postgres; 输入新的密码: 再次键入: 创建用户 postgres=# create user test...with password 'test'; CREATE ROLE 创建数据库 postgres=# create database testdb owner test; CREATE DATABASE...-U postgres -h 127.0.0.1 #添加新用户和新数据库以后,就要以新用户的名义登录数据库,使用的是psql命令。...psql -U dbuser -d exampledb -h 127.0.0.1 -p 5432 3.数据库操作 # 创建新表 CREATE TABLE user_tbl(name VARCHAR(20
resource queue "pg_default" CREATE ROLE 2.1.2.2检验创建的role $ psql -h 192.168.***.55 -U user1 -d china*...** Password for user user1: psql (8.3.23) Type "help" for help. china***=> 2.1.3 撤销用户的权限 2.1.3.1 删除没有授权的账户...$ psql -h 192.168.***.55 -U user2 -d auth_test Password for user user2: psql: FATAL: password authentication...-h 192.168.***.55 -U user1 -d auth_test Password for user user1: psql: FATAL: password authentication...2.3.2 创建USER2 # create role user2 with login password '123456'; NOTICE: resource queue required -- using
zxvf cmake-3.15.1-Linux-x86_64.tar.gz # mv cmake-3.15.1-Linux-x86_64 cmake-3.15.1 # mv cmake-3.15.1 /user...官方下载pg_prometheus源码,执行如下命令即可编译: # make # make install # Might require super user permissions 在make时可能会遇到如下问题...使用psql创建扩展:CREATE EXTENSION pg_prometheus; 创建role: CREATE ROLE admin WITH LOGIN PASSWORD 'admin'; 授权...=admin -pg.host=${psqlIP} -pg.port=5432 -pg.password=admin -pg.database=postgres -pg.prometheus-log-samples.../prometheus-postgresql-adapter -pg.user=admin -pg.password=admin -pg.database=postgres -pg.prometheus-log-samples
pgpool-II安装 》 本示例涉及到在线恢复;需要安装 pgpool_recovery -- 在 primary 操作 psql -c "create extension pgpool_recovery..." template1 3、配置 PostgreSQL 数据库 primary 节点操作 创建数据库用户 alter user postgres password '123456'; CREATE ROLE...pgpool WITH LOGIN password '123456';; CREATE ROLE replica WITH REPLICATION LOGIN password 'replica';...password> server2:5432:replication:repl: server3:5432:replication:repl:<repl user...= 5 health_check_user = 'pgpool' health_check_password = '123456' health_check_database = 'postgres'
第一件事是使用\password命令,为postgres用户设置一个密码。...CREATE USER dbuser WITH PASSWORD 'password'; 第三件事是创建用户数据库,这里为exampledb,并指定所有者为dbuser。...sudo -u postgres psql \password dbuser \q 接着,在shell命令行下,创建数据库exampledb,并指定所有者为dbuser。...psql exampledb < exampledb.sql 四、控制台命令 除了前面已经用到的\password命令(设置密码)和\q命令(退出)以外,控制台还提供一系列其他命令。...# 创建新表 CREATE TABLE user_tbl(name VARCHAR(20), signup_date DATE); # 插入数据 INSERT INTO user_tbl(name
第一件事是使用\password命令,为postgres用户设置一个密码。 \password postgres 第二件事是创建数据库用户dbuser(刚才创建的是Linux系统用户),并设置密码。...CREATE USER dbuser WITH PASSWORD ‘password’; 第三件事是创建用户数据库,这里为exampledb,并指定所有者为dbuser。...sudo -u postgres psql \password dbuser \q 接着,在shell命令行下,创建数据库exampledb,并指定所有者为dbuser。...psql exampledb < exampledb.sql 四、控制台命令 除了前面已经用到的\password命令(设置密码)和\q命令(退出)以外,控制台还提供一系列其他命令。...# 创建新表 CREATE TABLE user_tbl(name VARCHAR(20), signup_date DATE); # 插入数据 INSERT INTO user_tbl(name,
// 使用 psql 命令进去如数据库管理 psql -U posrgres -d dbname // 显示数据库 \l // 选择数据库 \c dbname // 列出当前数据库的所有表格...\conninfo // 创建数据库 CREATE DATABASE dbname // 删除数据库 DROP DATABASE dbname # 创建新账户 CREATE USER $username...WITH PASSWORD 'aaaaaa'; # 创建新数据库并将 OWNER 设置为新创建的帐户 CREATE DATABASE $dbname OWNER $username; # 给新用户授权...$dbname -f public.sql # 创建新账户 CREATE USER data_governance_analysis WITH PASSWORD 'qqqqq'; # 给新用户授权只读模式...alter user data_governance_analysis set default_transaction_read_only=on; # 切换到库gra \c gra # 赋权select
设置密码 切换用户 sudo su - postgres 使用下面命令进入PostgreSQL命令行交互页面 psql 输入下面命令设置密码为postgres_pwd \password postgres...Enter new password for user “postgres”: Enter it again: 创建数据库和表 使用下面命令创建数据库 CREATE DATABASE test_db...; \c test_db CREATE TABLE accounts(user_id INT PRIMARY KEY, username VARCHAR(50) UNIQUE NOT NULL, password...('127.0.0.1:5432', 'test_db', 'accounts', 'postgres', 'postgres_pwd') PRIMARY KEY user_id; CREATE TABLE...(STD_EXCEPTION) 数据库写入数据 在psql的交互页面输入 INSERT INTO accounts(user_id, username, password, email) VALUES
[root@vm-06 ~]# su - postgres -bash-4.2$ psql -c "alter user postgres with password 'password'" ALTER...testdb psql (9.2.23) Type "help" for help....testdb=> alter user devops with password 'password'; ALTER ROLE testdb=> create table test (no int,name...text ); CREATE TABLE testdb=> insert into test (no,name) values (1,'devops'); INSERT 0 1 testdb...: # "replica" user's password -bash-4.2$ vi /var/lib/pgsql/data/postgresql.conf hot_standby = on
-U postgres #进入数据库后修改密码; postgres=# alter user postgres with password 'postgres@123' ?.../32” 代表client ip,“trust”代表认证方式; #认证方式除“trust”外,还有“peer”, “ident”, “md5”, “password”等,具体可参考pg-hba文件: https...简单使用 1)创建用户 postgres=# create user postuser1 with password 'user1@123'; 2)创建数据库 #同时指定数据库的所有者 postgres...=# create database postdb1 owner postuser1; 3)数据库赋权 #未赋权则账户只能登录控制台 postgres=# grant all privileges on...5)创建表 postdb1=> create table tb1( id int primary key, name VARCHAR(20),
按:q退出查看 之后需要做以下几件事: 创建postgres用户 CREATE USER postgres WITH PASSWORD 'password'; 删除默认生成的postgres数据库...DROP DATABASE postgres; 创建属于postgres用户的postgres数据库 CREATE DATABASE postgres OWNER postgres; 将数据库所有权限赋予...-U [user] -d [database] -h [host] -p [post] -U指定用户,-d指定数据库,-h指定服务器,-p指定端口 上方直接使用psql登录控制台,实际上使用的是缺省数据...user:当前mac用户 database:用户同名数据库 主机:localhost 端口号:5432,postgresql的默认端口是5432 完整的登录命令,比如使用postgres用户登录 psql...\password [user]: 修改用户密码 \q:退出
-U postgres #进入数据库后修改密码; postgres=# alter user postgres with password 'postgres@123' 2..../32” 代表client ip,“trust”代表认证方式; #认证方式除“trust”外,还有“peer”, “ident”, “md5”, “password”等,具体可参考pg-hba文件: https...简单使用 1)创建用户 postgres=# create user postuser1 with password 'user1@123'; 2)创建数据库 #同时指定数据库的所有者 postgres...=# create database postdb1 owner postuser1; 3)数据库赋权 #未赋权则账户只能登录控制台 postgres=# grant all privileges on...-U postuser1 -d postdb1 -h 127.0.0.1 -p 5432 5)创建表 postdb1=> create table tb1( id int primary
领取专属 10元无门槛券
手把手带您无忧上云