备份及;在windows 7中恢复PostgreSQL数据库并使用laravel设置本地主机环境
1) 打开C:\Program Files\PostgreSQL\12\data\pg\u hba.conf 更改: 主机所有::1/128 md5 到 主机所有::1/128信任 2) 打开pgAdmin&创建一个本地主机服务器,用户名为postgres,密码为空 /*用于备份或还原现有数据库名称的转储*/ 打开cmd行,转到C:\Program Files\PostgreSQL\12\bin并按enter键 并根据需要键入以下命令 备份: pg_dump.exe-U postgres-d dbname-f d:\Backup\备份及;在windows 7中恢复PostgreSQL数据库并使用laravel设置本地主机环境,windows,postgresql,laravel-5,pgadmin-4,Windows,Postgresql,Laravel 5,Pgadmin 4,1) 打开C:\Program Files\PostgreSQL\12\data\pg\u hba.conf 更改: 主机所有::1/128 md5 到 主机所有::1/128信任 2) 打开pgAdmin&创建一个本地主机服务器,用户名为postgres,密码为空 /*用于备份或还原现有数据库名称的转储*/ 打开cmd行,转到C:\Program Files\PostgreSQL\12\bin并按enter键 并根据需要键入以下命令 备份: pg_dump.exe-U postgres-d d
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
如何在Laravel中备份PostgreSql数据库
composer需要空间/拉维备份
date_default_timezone_set('EST');
try {
$this->info('The backup has been started');
$backup_name = 'backup-' . date('c') . '.sql';
$backup_path = 'app/backups/' . $backup_name;
PostgreSql::create()
->setDbName(env('DB_DATABASE'))
->setUserName(env('DB_USERNAME'))
->setPassword(env('DB_PASSWORD'))
->dumpToFile($backup_path);
$this->info('The backup has been proceed successfully.');
} catch (ProcessFailedException $exception) {
logger()->error('Backup exception', compact('exception'));
$this->error('The backup process has been failed.');
}
使用space\DbDumper\Databases\PostgreSql代码>
date_default_timezone_set('EST');
try {
$this->info('The backup has been started');
$backup_name = 'backup-' . date('c') . '.sql';
$backup_path = 'app/backups/' . $backup_name;
PostgreSql::create()
->setDbName(env('DB_DATABASE'))
->setUserName(env('DB_USERNAME'))
->setPassword(env('DB_PASSWORD'))
->dumpToFile($backup_path);
$this->info('The backup has been proceed successfully.');
} catch (ProcessFailedException $exception) {
logger()->error('Backup exception', compact('exception'));
$this->error('The backup process has been failed.');
}