Установка postgresql CentOS 6.9
- sudo rpm -Uvh http://yum.postgresql.org/9.5/redhat/rhel-6-x86_64/pgdg-redhat95-9.5-2.noarch.rpm
- yum install postgresql95-server postgresql95-contrib
- service postgresql-9.5 initdb
- service postgresql-9.5 start
- chkconfig postgresql-9.5 on
Для доступа извне
- mcedit /var/lib/pgsql/9.5/data/postgresql.conf
listen_addresses = '*'
port = 5432
- mcedit /etc/sysconfig/iptables
-A INPUT -p tcp -m tcp --dport 5432 -j ACCEPT
Добавим возможность подключаться из локальной сети используя авторизацию по md5 и без пароля с этого же компьютера
- mcedit /var/lib/pgsql/9.5/data/pg_hba.conf
host all all 127.0.0.1/32 trust
host all all 192.168.180.0/24 md5local all all peer
# IPv4 local connections:
host all all 127.0.0.1/32 ident
# IPv6 local connections:
host all all ::1/128 ident
- /etc/init.d/postgresql-9.5 reload
- su - postgres
-bash-4.1$ createuser helloasterisk
Создадим базу данных
- createdb helloasterisk
- psql
- alter user helloasterisk with encrypted password 'helloasterisk!';
- grant all privileges on database helloasterisk to helloasterisk;
- -bash-4.1$ psql helloasterisk < /home/sergeev/billing2
ошибка
no pg_hba.conf entry for host
- find / -name pg_hba.conf
- mcedit /var/lib/pgsql/9.5/data/pg_hba.conf
hostnossl all all 0.0.0.0/0 md5
- service postgresql-9.5 reload
Просмотр таблиц
SELECT table_name FROM information_schema.tables
WHERE table_schema NOT IN ('information_schema','helloasterisk');
Просмотр таблицы
SELECT * FROM accounts;Удаление базы
- dropdb helloasterisk
**********************************
Гайд для установки базы
- su - postgres
- psql helloasterisk < /home/billingD4.sql
- dropdb helloasterisk
- createdb helloasterisk
Комментарии
Отправить комментарий