Skip to content
This repository has been archived by the owner on Apr 1, 2023. It is now read-only.

How to Install Database ?

Shrimadhav U K edited this page Oct 24, 2020 · 1 revision

How to Install Database ?

I use postgres, so I recommend using it for optimal compatibility.

In the case of postgres, this is how you would set up a the database on a Arch Linux system. Other distributions may vary.

  • install postgresql:

sudo pacman -Syy && sudo pacman -S postgresql

  • change to the postgres user:

sudo -iu postgres

  • initialize the database cluster

initdb --locale=en_US.UTF-8 -E UTF8 -D /var/lib/postgres/data

  • create a new database user (change YOUR_USER appropriately):

createuser -P -s -e YOUR_USER

This will be followed by you needing to input your password.

  • create a new database table:

createdb -O YOUR_USER YOUR_DB_NAME

Change YOUR_USER and YOUR_DB_NAME appropriately.

  • testing your database connection:

psql YOUR_DB_NAME -h YOUR_HOST YOUR_USER

This will allow you to connect to your database via your terminal. By default, YOUR_HOST should be 0.0.0.0:5432.

You should now be able to build your database URI. This will be:

sqldbtype://username:pw@hostname:port/db_name

To secure your DataBase installation, please read https://wiki.archlinux.org/index.php/PostgreSQL

Replace sqldbtype with whichever db youre using (eg postgres, mysql, sqllite, etc) repeat for your username, password, hostname (localhost?), port (5432?), and db name.

Clone this wiki locally