Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't backup an application that uses read and write database hosts #30

Closed
olimorris opened this issue Apr 26, 2015 · 4 comments
Closed
Labels

Comments

@olimorris
Copy link

In my database.php file, my config/database.php file has the following connection specified:

        'mysql'   => [
            'read'      => [
                'host'  => env('DB_HOST_READ') . (('homestead' == env('DB_USERNAME') && 'homestead' != gethostname()) ? ':33060' : '')
            ],
            'write'     => [
                'host'  => env('DB_HOST_WRITE') . (('homestead' == env('DB_USERNAME') && 'homestead' != gethostname()) ? ':33060' : '')
            ],
            'driver'    => 'mysql',
            'database'  => env('DB_DATABASE'),
            'username'  => env('DB_USERNAME'),
            'password'  => env('DB_PASSWORD'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

and this results in the following error:

  [Exception]
  Whoops, Undefined index: host

When I change my config/database.php file to:

        'mysql'   => [
            'driver'    => 'mysql',
            'database'  => env('DB_DATABASE'),
            'host'      => env('DB_HOST') . (('homestead' == env('DB_USERNAME') && 'homestead' != gethostname()) ? ':33060' : ''),
            'username'  => env('DB_USERNAME'),
            'password'  => env('DB_PASSWORD'),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

...it works like a charm. Just something to be aware of.

@freekmurze freekmurze added the bug label Apr 26, 2015
@freekmurze
Copy link
Member

This is fixed in release 2.3.0

@olimorris
Copy link
Author

Keep up the good work!

@patriziotomato
Copy link

I'm using v3.8.1 and have the same problem right now after switching to laravels read/write host config:

    'mysql' => [
        'driver'    => 'mysql',
        'read' => [
            'host'      => env('DB_HOST', '192.168.0.208'),
        ],
        'write' => [
            'host'      => env('DB_HOST', '192.168.0.208'),
        ],
        'database'  => env('DB_DATABASE', 'xx'),
        'username'  => env('DB_USERNAME', 'xx'),
        'password'  => env('DB_PASSWORD', 'xx'),
        'charset'   => 'utf8',
        'collation' => 'utf8_unicode_ci',
        'prefix'    => '',
        'strict'    => false,
        'options'   => [
            PDO::MYSQL_ATTR_LOCAL_INFILE => true,
        ],
        'dump_command_timeout' => 60 * 5, // https://docs.spatie.be/laravel-backup/v3/installation-and-setup
    ],

@freekmurze
Copy link
Member

@brainless81 see #163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants