Postgresql登录建库

postgres@ubuntuq-HP-Compaq-6910p-RH241AV:~$ psql -U geeklee -d postgres -h 127.0.0.1 -p 5432
#登录
Password for user geeklee: 
#输入密码138
psql (9.3.11)
SSL connection (cipher: DHE-RSA-AES256-GCM-SHA384, bits: 256)
Type "help" for help.

postgres=# \du

#查询已经建好的数据库                             
List of roles
 Role name |                   Attributes                   | Member of 
-----------+------------------------------------------------+-----------
 dbuser    | Superuser, Create role, Create DB              | {}
 deploy    |                                                | {}
 geekle    | Superuser, Create role, Create DB              | {}
 geeklee   | Superuser, Create role, Create DB              | {}
 postgres  | Superuser, Create role, Create DB, Replication | {}


postgres=# CREATE DATABASE pydata2;
#建新数据库,库名为pydata2,;分号注意
CREATE DATABASE
postgres=# 
ubuntuq@ubuntuq-HP-Compaq-6910p-RH241AV:~/临时文件夹/mysite$ python manage.py shell
Python 2.7.6 (default, Jun 22 2015, 17:58:13) 
Type "copyright", "credits" or "license" for more information.

IPython 5.1.0 -- An enhanced Interactive Python.
?         -> Introduction and overview of IPython's features.
%quickref -> Quick reference.
help      -> Python's own help system.
object?   -> Details about 'object', use 'object??' for extra details.

In [1]: from django.db import connection

In [2]: cursor = connection.cursor

In [3]: 

你可能感兴趣的:(数据库)