1. In a terminal:
$ psql2. Get into a postgresql with role "postgres", then create a user "db"
postgres-# create role dbcreator with password 'nifti';
3. Change user to postgres
$ sudo su postgres
postgres@computername:/home/$ sudo su postgres
4. Create db mydb and get into mydb
postgres@computername:/home/$ psql
postgres=# create database mydb with owner=dbcreator;
How to get help :
postgres=# \h create database
5. 返回username用户下,进入mydb
username@computername:/home/db$ psql -d mydb
mydb=#
6. search commands:
mdb=# \?
7. Check table in mydb
mdb=# \d
8. Then we know \i can run a file
mydb=\i createdummy.sql
9. At last, we create a table for storage a ROS bag data, and we retrieval data by its id, topic, type, sizeoftopic or target.
*/db $ python extract* *.bag
10. Make the database can be accessed by remote users
本文详细介绍了如何使用PostgreSQL通过角色权限创建用户、数据库,以及基本的数据库操作,包括创建数据库、切换用户、搜索命令、检查表、运行SQL文件、创建存储ROS bag数据的表格并检索数据。

被折叠的 条评论
为什么被折叠?



