LightDB-创建数据库
createdb [OPTION]... [DBNAME] [DESCRIPTION]
#指令帮助
$ createdb --help
createdb creates a LightDB database.
Usage:
createdb [OPTION]... [DBNAME] [DESCRIPTION]
Options:
-D, --tablespace=TABLESPACE default tablespace for the database
-e, --echo show the commands being sent to the server
-E, --encoding=ENCODING encoding for the database
-l, --locale=LOCALE locale settings for the database
--lc-collate=LOCALE LC_COLLATE setting for the database
--lc-ctype=LOCALE LC_CTYPE setting for the database
-O, --owner=OWNER database user to own the new database
-T, --template=TEMPLATE template database to copy
-V, --version output version information, then exit
-?, --help show this help, then exit
Connection options:
-h, --host=HOSTNAME database server host or socket directory
-p, --port=PORT database server port
-U, --username=USERNAME user name to connect as
-w, --no-password never prompt for password
-W, --password force password prompt
--maintenance-db=DBNAME alternate maintenance database
By default, a database with the same name as the current user is created.
Report bugs to <https://github.com/hslightdb>.
LightDB home page: <https://www.hs.net/lightdb>
创建一个新数据库,命名为:mydb
[lightdb@localhost ~]$ createdb mydb
查验创建结果
[lightdb@localhost ~]$ ltsql
ltsql (13.8-22.3)
Type "help" for help.
lightdb@lt_test=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+---------+----------+------------+------------+---------------------
lightdb | lightdb | UTF8 | en_US.utf8 | en_US.utf8 |
lt_test | lightdb | UTF8 | en_US.utf8 | en_US.utf8 |
mydb | lightdb | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | lightdb | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | lightdb | UTF8 | en_US.utf8 | en_US.utf8 | =c/lightdb +
| | | | | lightdb=CTc/lightdb
template1 | lightdb | UTF8 | en_US.utf8 | en_US.utf8 | =c/lightdb +
| | | | | lightdb=CTc/lightdb
(6 rows)
删除数据库
[lightdb@localhost ~]$ dropdb mydb
lightdb@lt_test=# \l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+---------+----------+------------+------------+---------------------
lt_test | lightdb | UTF8 | en_US.utf8 | en_US.utf8 |
postgres | lightdb | UTF8 | en_US.utf8 | en_US.utf8 |
template0 | lightdb | UTF8 | en_US.utf8 | en_US.utf8 | =c/lightdb +
| | | | | lightdb=CTc/lightdb
template1 | lightdb | UTF8 | en_US.utf8 | en_US.utf8 | =c/lightdb +
| | | | | lightdb=CTc/lightdb
(4 rows)