Skip to content

meyerben/Ama

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

84 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

https://docs.c9.io/v1.0/docs/setting-up-postgresql

http://stackoverflow.com/questions/17443379/psql-fatal-peer-authentication-failed-for-user-dev
edit /etc/postgres/postgres.conf for localhost connection
edit /etc/postgres/pq_hba.conf for local all all peer -> md5

sudo -u postgres psql -s dn_name
createdb test
create database "test"
\l, \d+ \du \dn \list ...
create user "ama";
\password user_name
grant all on database ama to ama;

$ sudo sudo -u postgres psql
=# create database "dbname";
\dt table (show tables)
\d+ (describe table)
\du (show users)
grant all on database dbname to mojo;
alter table t alter column c type t
insert into t (c1, c2) values (v1, v2) returning id
select SUM(CASE WHEN vote = 'up' THEN 1 ELSE -1 END) AS votes from votes where entry_type='questions' and entry_id=1;
select question,comment from questions left join comments on questions.id=comments.question_id where questions.id=1 and answer is not null;


File /etc/postgresql/9.3/main/postgresql.conf saved
File /etc/postgresql/9.3/main/pg_hba.conf saved
ubuntu@db-trusty:~$ sudo /etc/init.d/postgresql restart
 * Restarting PostgreSQL 9.3 database server                                                                                                                                   [ OK ] 
ubuntu@db-trusty:~$ sudo sudo -u postgres psql
psql (9.3.8)
Type "help" for help.

postgres=# create database "ama";
CREATE DATABASE
postgres=# create user "ama";
CREATE ROLE
postgres=# \password ama
Enter new password: 
Enter it again: 
postgres=# grant all on database ama to ama;
GRANT

EACH TIME RUN:
sudo /etc/init.d/postgresql restart
morbo -l http://*:8080 script/ama

About

Ask Me Anything

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 38.6%
  • Perl 35.4%
  • CSS 14.8%
  • PLpgSQL 10.6%
  • Other 0.6%