zl程序教程

您现在的位置是:首页 >  数据库

当前栏目

lightdb创建初始数据库和用户

数据库 创建 用户 初始 lightdb
2023-09-27 14:28:33 时间
[root@hs-10-20-30-199 ~]# su - lightdb
Last login: Wed May 25 13:16:32 CST 2022 from 10.188.120.129 on pts/10
[lightdb@hs-10-20-30-199 ~]$ ltsql
ltsql: error: could not connect to server: No such file or directory
    Is the server running locally and accepting
    connections on Unix domain socket "/tmp/.s.LIGHTDB.5432"?
[lightdb@hs-10-20-30-199 ~]$ ltsql -p8000
ltsql (13.3-22.2)
Type "help" for help.

lightdb@postgres=# create database ltdb;
NOTICE:  Canopy partially supports CREATE DATABASE for distributed databases
DETAIL:  Canopy does not propagate CREATE DATABASE command to workers
HINT:  You can manually create a database and its extensions on workers.
CREATE DATABASE
lightdb@postgres=# create user ltuser with password 'ltpwd';
NOTICE:  not propagating CREATE ROLE/USER commands to worker nodes
HINT:  Connect to worker nodes directly to manually create all necessary users and roles.
CREATE ROLE
lightdb@postgres=# alter database ltdb owner to ltuser;
ALTER DATABASE
lightdb@postgres=# exit
[lightdb@hs-10-20-30-199 ~]$ ltsql -Ultuser -p8000
ltsql (13.3-22.2)
Type "help" for help.

ltuser@postgres=> select current_user;
 current_user 
--------------
 ltuser
(1 row)