Відмінності між версіями «PostgreSQL»
Перейти до навігації
Перейти до пошуку
| Рядок 40: | Рядок 40: | ||
template1=# CREATE USER andrew WITH PASSWORD 'myPassword'; | template1=# CREATE USER andrew WITH PASSWORD 'myPassword'; | ||
template1=# CREATE DATABASE mydb; | template1=# CREATE DATABASE mydb; | ||
| − | template1=# GRANT ALL PRIVILEGES ON DATABASE | + | template1=# GRANT ALL PRIVILEGES ON DATABASE mydb to andrew; |
template1=# \q | template1=# \q | ||
тестуваня | тестуваня | ||
$ su - andrew | $ su - andrew | ||
$ psql -d mydb -U andrew | $ psql -d mydb -U andrew | ||
| − | |||
== Віддалений доступ == | == Віддалений доступ == | ||
Версія за 23:09, 10 квітня 2010
Зміст
Встановлення старої версії
# yum install postgresql postgresql-server
Встановлення нової версії
добавляємо репозиторій c5-testing.repo:
[c5-testing] name=CentOS-5 Testing. baseurl=http://dev.centos.org/centos/$releasever/testing/$basearch/ enabled=0 gpgcheck=1 gpgkey=http://dev.centos.org/centos/RPM-GPG-KEY-CentOS-testing
yum --disablerepo=\* --enablerepo=c5-testing install postgresql-server postgresql
перед першим запуском
# service postgresql initdb
-A RH-Firewall-1-INPUT -m state --state NEW -m tcp -p tcp --dport 5432 -j ACCEPT
Налаштування
- cp /usr/share/pgsql/pg_hba.conf.sample /var/lib/pgsql/data/pg_hba.conf
Запуск
# chkconfig postgresql on # service postgresql start
Вхід у консоль
# su - postgres $ psql template1
or
$ psql -d template1 -U postgres
Створення користувача
# adduser andrew # passwd andrew # su - postgres $ psql template1 template1=# CREATE USER andrew WITH PASSWORD 'myPassword'; template1=# CREATE DATABASE mydb; template1=# GRANT ALL PRIVILEGES ON DATABASE mydb to andrew; template1=# \q
тестуваня
$ su - andrew $ psql -d mydb -U andrew