DB EXPERIENCE WITH RUST DIESEL POSTGRESQL AND WITHOUT FEAR OF SUCCESS
sudo pacman -Syu postgresql
- Open as postgres user
sudo -iu postgres
- Initializing the database of regional and specify dirs to save db datas in this case /var/lib/..
initdb --locale $LANG -E UTF8 -D '/var/lib/postgres/data'
exit
- Starting postgres service
sudo systemctl start postgresql
- Setup to running when the os is initializing
sudo systemctl enable postgresql
sudo -iu postgres
psql
- Make a database and user
CREATE DATABASE my_own_db;
CREATE USER diesel_user WITH PASSWORD 'default';
GRANT ALL PRIVILEGES ON DATABASE my_own_db;
- (!) Important step, you need specify that you are also the owner of the db in addition to having the permissions.
ALTER DATABASE my_own_db OWNER TO diesel_user;
\q
exit
- Set enviroment vars on files
echo "DATABASE_URL=postgres://diesel_user:default@localhost/my_own_db" >> .env
diesel setup