E
E
Egor Mikheev2016-08-25 10:14:55
linux
Egor Mikheev, 2016-08-25 10:14:55

What are the best options for creating a full database backup via console and PHP?

Hello, the task is to create a full backup of all databases for the user.
Is it possible to dump to PHP via PDO (for example, to maintain multiplatform)?
this is how the PHP code looks like with the console option

exec('mysqldump '
                    . '--user='.$value['username']
                    .' --password='.$value['password']
                    .' --host='.$value['host']
                    .' -A'
                    .' >'
                    .$backupDir
                    .'/'
                    .$key
                    .'-'.$value['host']
                    .'-'.$value['database']
                    .'.sql');
        }

so with the line:
mysqldump -u root -h82.82.82.82 -p Pass -A > all-databases.sql

Answer the question

In order to leave comments, you need to log in

1 answer(s)
E
Egor Mikheev, 2016-08-25
@ogregor

found such solution https://github.com/ifsnop/mysqldump-php

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question