Skip to content

Commit b08afc1

Browse files
committed
Add postgre instruction to README
1 parent fdfc0fc commit b08afc1

File tree

1 file changed

+48
-1
lines changed

1 file changed

+48
-1
lines changed

README.md

Lines changed: 48 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ $ composer install
6565

6666
# install app's dependencies
6767
$ npm install
68+
```
69+
70+
### If you choice to use SQLite
71+
72+
``` bash
6873

6974
# create database
7075
$ touch database/database.sqlite
@@ -81,8 +86,50 @@ Then in file ".env" replace this database configuration:
8186
To this:
8287

8388
* DB_CONNECTION=sqlite
84-
* DB_DATABASE=/path_to_your_project/my-project/laravel/database/database.sqlite
89+
* DB_DATABASE=/path_to_your_project/database/database.sqlite
90+
91+
### If you choice to use PostgreSQL
92+
93+
1. Install PostgreSQL
94+
95+
2. Create user
96+
``` bash
97+
$ sudo -u postgres createuser --interactive
98+
enter name of role to add: laravel
99+
shall the new role be a superuser (y/n) n
100+
shall the new role be allowed to create database (y/n) n
101+
shall the new role be allowed to create more new roles (y/n) n
102+
```
103+
3. Set user password
104+
``` bash
105+
$ sudo -u postgres psql
106+
postgres= ALTER USER laravel WITH ENCRYPTED PASSWORD 'password';
107+
postgres= \q
108+
```
109+
4. Create database
110+
``` bash
111+
$ sudo -u postgres createdb laravel
112+
```
113+
5. Copy file ".env.example", and change its name to ".env".
114+
Then in file ".env" replace this database configuration:
115+
116+
* DB_CONNECTION=mysql
117+
* DB_HOST=127.0.0.1
118+
* DB_PORT=3306
119+
* DB_DATABASE=laravel
120+
* DB_USERNAME=root
121+
* DB_PASSWORD=
122+
123+
To this:
124+
125+
* DB_CONNECTION=pgsql
126+
* DB_HOST=127.0.0.1
127+
* DB_PORT=5432
128+
* DB_DATABASE=laravel
129+
* DB_USERNAME=laravel
130+
* DB_PASSWORD=password
85131

132+
### Next step
86133

87134
``` bash
88135
# in your app directory

0 commit comments

Comments
 (0)