Laravel-backup: How to config spatie/laravel-backup when datadase was on another machine

Created on 16 Jun 2017  路  7Comments  路  Source: spatie/laravel-backup

I try to use spatie/laravel-backup, In my local I can config 'dump_binary_path' => '/usr/local/mysql/bin'.

But in my PROD server database was on another machine. My application call database server from IP.

How to config 'dump_binary_path' for PROD server?

Laravel 5.4
spatie/laravel-backup 4.18.0

Most helpful comment

You can install the mysql-client package on your application server, which gives you access to mysql and mysqldump. These binaries CAN access remote servers (assuming the user that is used to connect with has permission, but that's a MySQL issue, not one related to this package, although it affects this package).

Read more on mysql network security here if you're not familiar with creating users to connect from different hosts looks like in MySQL.

In any case, this package would need to pass the -h flag to mysqldump for that to work, e.g.:

mysqldump -h prod-hostname -u some_user -p'some-password' [...other flags...] ...

I haven't checked to see if the package does that already - sounds like it does!

All 7 comments

Use an environment variable in the config file

https://laravel.com/docs/5.4/configuration#environment-configuration

What ??? @freekmurze Are you understood my question.

I mean 'dump_binary_path'. If database server was in localhost or same machine.
I can use 'dump_binary_path' => '/usr/local/mysql/bin'.
But if database server was on another machine.

How to set it.
'dump_binary_path' => '192.168.0.1'??? Some thing like this.

Sorry, misread your question.

I've got no experience with this kind of setup myself. I'm thinking that the mysqldump binary should reside on the same server as your app but I'm not sure if the binary can dump a database that resides on another server.

Toy a bit around with it and post your findings in this issue to help other users of this package.

Closing this for now, feel free to reopen if you have more questions.

You can install the mysql-client package on your application server, which gives you access to mysql and mysqldump. These binaries CAN access remote servers (assuming the user that is used to connect with has permission, but that's a MySQL issue, not one related to this package, although it affects this package).

Read more on mysql network security here if you're not familiar with creating users to connect from different hosts looks like in MySQL.

In any case, this package would need to pass the -h flag to mysqldump for that to work, e.g.:

mysqldump -h prod-hostname -u some_user -p'some-password' [...other flags...] ...

I haven't checked to see if the package does that already - sounds like it does!

thanks @fideloper .worked for me.

I was facing the same problem on local.
I fixed it by changing the path.
'dump_binary_path' => "I://xampp//mysql//bin/",

Was this page helpful?
0 / 5 - 0 ratings