Re: One Button DB backup
| From: | Tedd Sperling | Date: | Sat, 05 Nov 2016 21:17:24 +0000 |
| Subject: | Re: One Button DB backup | ||
| References: | 1 2 3 4 5 | Groups: | php.general php.general |
| Request: | Send a blank email to php-general+get-325823@lists.php.net to get a copy of this message | ||
> On Nov 5, 2016, at 4:15 PM, Adam Jon Richardson <adamjonr@gmail.com> wrote:
>
> On Sat, Nov 5, 2016 at 3:52 PM, Adam Jon Richardson <adamjonr@gmail.com>
> wrote:
>
>> On Sat, Nov 5, 2016 at 3:41 PM, Tedd Sperling <tedd@sperling.com> wrote:
>>
>>>
>>>> On Nov 5, 2016, at 10:12 AM, Paul M Foster <paulf@quillandmouse.com>
>>> wrote:
>>>>
>>>> On Fri, Nov 04, 2016 at 01:14:37PM -0400, Tedd Sperling wrote:
>>>>
>>>>> Hi gang:
>>>>>
>>>>> I am in need of a one-button backup of a database via a php script
>>>
>>
>> Something like this little bit of code works:
>> -snip-
>
> Just a few quick follow-up points on this method:
>
> 1) This approach shouldn't be used on a shared server, as the command-line
> logs could be viewed by others to gain the DB credentials (not an issue in
> the cases I've used this approach, as the server was only hosting one
> website.)
>
> 2) I forgot that this approach requires no space between the password and
> the -p argument, so it should read:
> $command = "mysqldump --add-drop-table -h localhost " .
> "-u USERNAME -pPASSWORD DBNAME > FILETOPIPETO";
> $ret_val = null;
> // create current backup
> $output = system($command, $ret_val);
>
> Adam
Adam:
Thanks — I think that will do it.
Cheers,
tedd