jeudi 21 mai 2020

Backup & Restore PostgreSQL database and setup localhost environment with laravel in windows 7

1) open C:\Program Files\PostgreSQL\12\data\pg_hba.conf

change: host all all ::1/128 md5

to

host all all ::1/128 trust

2)open pgAdmin & create a localhost server with username postgres and password will empty

/* For taking a backup or restore a dump of existing database name */

open cmd line and go to C:\Program Files\PostgreSQL\12\bin and press enter

and type below command as required

Take Backup : pg_dump.exe -U postgres -d dbname -f D:\Backup\

 or direct take backup using pgAdmin backup option and store in D:\Backup\<backup-file-name>  

hint: backup file should be tar or dump type

Restore Backup : pg_restore -U postgres -d dbname -1 D:\Backup\

3) In laravel code folder open .env file and add DB_SSLMODE=disable

4) in laravel code folder open config/database.php and for 'pgsql' array

 replace

     'sslmode'=> 'require', 

 to    
    'sslmode' => env('DB_SSLMODE','require'),


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire