Saminnet-Search Article Wiki Forum Piwigo SNS Cloud vtiger Sugar
Postgresql Create DB

Postgresql Create DB

Set up Database Server

  1. For the purposes of this guide we will assume this server has an IP address of 10.10.10.1
    • Optional: if installing on the same machine substitute 10.10.10.1 with 127.0.0.1
  2. Install PostgreSQL 9.4+ (or MySQL 5.6+)
    • sudo yum install http://yum.postgresql.org/9.4/redhat/rhel-6-x86_64/pgdg-redhat94-9.4-1.noarch.rpm
    • sudo yum install postgresql94-server postgresql94-contrib
    • sudo /usr/pgsql-9.4/bin/postgresql94-setup initdb
    • sudo systemctl enable postgresql-9.4.service
    • sudo systemctl start postgresql-9.4.service
  3. PostgreSQL created a user account called postgres. You will need to log into that account with:
    • sudo -i -u postgres
  4. You can get a PostgreSQL prompt by typing:
    • psql
  5. Create the Mattermost database by typing:
    • postgres=# CREATE DATABASE mattermost;
  6. Create the Mattermost user by typing:
    • postgres=# CREATE USER mmuser WITH PASSWORD 'mmuser_password';
  7. Grant the user access to the Mattermost database by typing:
    • postgres=# GRANT ALL PRIVILEGES ON DATABASE mattermost to mmuser;
  8. You can exit out of PostgreSQL by typing:
    • postgres=# \q
  9. You can exit the Postgres account by typing:
    • exit
  10. Allow Postgres to listen on all assigned IP Addresses:
    • sudo vi /var/lib/pgsql/9.4/data/postgresql.conf
    • Uncomment 窶詫isten_addresses窶 and change 窶詫ocalhost窶 to 窶*窶
  11. Alter pg_hba.conf to allow the Mattermost Server to talk to the Postgres database:
    • sudo vi /var/lib/pgsql/9.4/data/pg_hba.conf
    • Add the following line to the 窶露Pv4 local connections窶:
    • host all all 10.10.10.2/32 md5
  12. Reload Postgres database:
    • sudo systemctl reload postgresql-9.4.service
  13. Attempt to connect with the new created user to verify everything looks good:
    • psql --host=10.10.10.1 --dbname=mattermost --username=mmuser --password
    • mattermost=> \q

Comments   

 
0 #4 Guest 2016-08-15 12:50
---------------------------hba.conf----------------------------------------
local all all trust --->login dari root run backup script
host all all 127.0.0.1/32 md5 ----> postgres pakai password
host all all 192.168.137.7/2 4 md5
host all all ::1/128 ident -----> postgres no password
[root@monosvr data]# cat postgresql.conf |grep listen
listen_addresses = '*' # what IP address(es) to listen on;
Quote
 
 
0 #3 Super User 2016-08-12 11:57
Test Connection database
-bash-4.2$ psql --host=127.0.0. 1 --dbname=mitdb --username=post gres --password
Password for user postgres:
psql (9.5.3)
Type "help" for help.

mitdb=#
----------------------
pakai port 5432
# netstart -ant
---------
userdb harus pakai password
pg_hba.conf setup ip dan md5 (dbuser ada password)
Quote
 
 
0 #2 Guest 2016-08-12 11:44
Setup postgres password:
-bash-4.2$ psql
psql (9.5.3)
Type "help" for help.
postgres=# \password
Enter new password:
Enter it again:
postgres=# \q
-bash-4.2$
Quote
 
 
0 #1 Super User 2016-08-12 11:21
[root@localhost ~]# systemctl start postgresql-9.5
root@localhost ~]# systemctl enable postgresql-9.5
Created symlink from /etc/systemd/sy stem/multi-user .target.wants/p ostgresql-9.5.s ervice to /usr/lib/systemd/system/postgresql-9.5.service.
[root@localhost ~]#
Quote
 

Articles by Date

Category Database

TweetTweet Share on LinkedInShare on LinkedIn Share on Google+Google+ Submit to RedditReddit Publish on WordPress WordPress Send emailSend email