#cd /etc/apt/sources.list.d/
#vi pgdg.list
//add the line
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
#wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# sudo apt-get update
#sudo apt-get install postgresql-9.4
# sudo -u postgres psql
CREATE ROLE
postgres=# create database testdb;
CREATE DATABASE
postgres=# grant all privileges on databases testdb to boobalan;
ERROR: syntax error at or near "testdb"
LINE 1: grant all privileges on databases testdb to boobalan;
^
postgres=# GRANT ALL PRIVILEGS ON DATABASE testdb TO boobalan;
ERROR: syntax error at or near "PRIVILEGS"
LINE 1: GRANT ALL PRIVILEGS ON DATABASE testdb TO boobalan;
^
postgres=# GRANT ALL PRIVILEGES ON DATABASE testdb TO boobalan;
GRANT
postgres=# \connect testdb
You are now connected to database "testdb" as user "postgres".
testdb=# select *;
ERROR: SELECT * with no tables specified is not valid
LINE 1: select *;
^
testdb=# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO testdb;
ERROR: role "testdb" does not exist
testdb=# GRANT ALL PRIVILEGES ON ALL TABLE IN SCHEMA public TO testdb;
Export data to sql file
sudo -u postgres pg_dump -f testdb.sql -d testdb
Import from sql file
sudo -u postgres psql -f testdb.sql testdb
Reset serial number
ALTER SEQUENCE product_id_seq RESTART WITH 1453;
root@ubuntu:~# service postgresql status
9.4/main (port 5432): online
root@ubuntu:~# service postgresql restart
* Restarting PostgreSQL 9.4 database server [ OK ]
#vi pgdg.list
//add the line
deb http://apt.postgresql.org/pub/repos/apt/ trusty-pgdg main
#wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
# sudo apt-get update
#sudo apt-get install postgresql-9.4
# sudo -u postgres psql
postgres=#
postgres=# create user boobalan with password 'treecare';CREATE ROLE
postgres=# create database testdb;
CREATE DATABASE
postgres=# grant all privileges on databases testdb to boobalan;
ERROR: syntax error at or near "testdb"
LINE 1: grant all privileges on databases testdb to boobalan;
^
postgres=# GRANT ALL PRIVILEGS ON DATABASE testdb TO boobalan;
ERROR: syntax error at or near "PRIVILEGS"
LINE 1: GRANT ALL PRIVILEGS ON DATABASE testdb TO boobalan;
^
postgres=# GRANT ALL PRIVILEGES ON DATABASE testdb TO boobalan;
GRANT
postgres=# \connect testdb
You are now connected to database "testdb" as user "postgres".
testdb=# select *;
ERROR: SELECT * with no tables specified is not valid
LINE 1: select *;
^
testdb=# GRANT ALL PRIVILEGES ON ALL SEQUENCES IN SCHEMA public TO testdb;
ERROR: role "testdb" does not exist
testdb=# GRANT ALL PRIVILEGES ON ALL TABLE IN SCHEMA public TO testdb;
Export data to sql file
sudo -u postgres pg_dump -f testdb.sql -d testdb
Import from sql file
sudo -u postgres psql -f testdb.sql testdb
Reset serial number
ALTER SEQUENCE product_id_seq RESTART WITH 1453;
root@ubuntu:~# service postgresql status
9.4/main (port 5432): online
root@ubuntu:~# service postgresql restart
* Restarting PostgreSQL 9.4 database server [ OK ]
No comments:
Post a Comment