postgreSQL数据库图形管理工具:pgadmin3-1.10.2.zip
[root@test Server]# service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [ OK ]
[root@test Server]# su - postgres
-bash-3.2$ psql -U postgres
postgres-# \q
[root@test Server]# service postgresql stop
Stopping postgresql service: [ OK ]
[root@test Server]# su - postgres
-bash-3.2$ pg_ctl start
postmaster starting
选择登录的数据库:
-bash-3.2$ psql -d template1
Welcome to psql 8.1.11, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
template1=# \q
重置“postgres”用户的密码
postgres=# alter user postgres with password '123456';
创建数据库:
-bash-3.2$ createdb test
CREATE DATABASE
-bash-3.2$ psql -d test
Welcome to psql 8.1.11, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
test=# \q
删除数据库
dropdb mydb
创建新表;
test=# create table weather(
test(# city varchar(80),
test(# temp_lo int,
test(# temp_hi int,
test(# prcp real,
test(# date date
test(# );
CREATE TABLE
test=#
向表中添加行;
test=# insert into weather values('beijing',-10,15,0.5,'2010-12-24');
INSERT 0 1
查询一个表;
test=# select * from weather;
[root@test Server]# service postgresql restart
Stopping postgresql service: [ OK ]
Starting postgresql service: [ OK ]
[root@test Server]# su - postgres
-bash-3.2$ psql -U postgres
postgres-# \q
[root@test Server]# service postgresql stop
Stopping postgresql service: [ OK ]
[root@test Server]# su - postgres
-bash-3.2$ pg_ctl start
postmaster starting
选择登录的数据库:
-bash-3.2$ psql -d template1
Welcome to psql 8.1.11, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
template1=# \q
重置“postgres”用户的密码
postgres=# alter user postgres with password '123456';
创建数据库:
-bash-3.2$ createdb test
CREATE DATABASE
-bash-3.2$ psql -d test
Welcome to psql 8.1.11, the PostgreSQL interactive terminal.
Type: \copyright for distribution terms
\h for help with SQL commands
\? for help with psql commands
\g or terminate with semicolon to execute query
\q to quit
test=# \q
删除数据库
dropdb mydb
创建新表;
test=# create table weather(
test(# city varchar(80),
test(# temp_lo int,
test(# temp_hi int,
test(# prcp real,
test(# date date
test(# );
CREATE TABLE
test=#
向表中添加行;
test=# insert into weather values('beijing',-10,15,0.5,'2010-12-24');
INSERT 0 1
查询一个表;
test=# select * from weather;
来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12137615/viewspace-682944/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/12137615/viewspace-682944/