Database issues when provisioning with multiple projects

I have a setup that looks like this:

  • Development/
    • trellis/
    • site1/
    • site2/

I’ve just assumed this is possible as long as you specify each site in group_vars/development/wordpress_sites.yml and their local_path references the correct folder.

When I provision this setup, my first site works, but my second one fails and I get the following error:
TASK: [mariadb | Set root user password] failed: [default] => (item=default) => {"failed": true, "item": "default"} msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials

I haven’t changed the root password. Any ideas? Is my setup invalid?

I’m having the exact same issue. When adding a second site to trellis en trying to do a provision I get the following error:

TASK: [mariadb | Set root user password] ************************************** failed: [default] => (item=default) => {"failed": true, "item": "default"} msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials failed: [default] => (item=127.0.0.1) => {"failed": true, "item": "127.0.0.1"} msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials failed: [default] => (item=::1) => {"failed": true, "item": "::1"} msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials failed: [default] => (item=localhost) => {"failed": true, "item": "localhost"} msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials

I managed to solve this by cloning Trellis to a completely new folder, moving Vagrantfile up one level (and setting athe ansible path in the Vagrantfile to “trellis/”) and then just adding site directories at the same level as Vagrantfile.

My file structure is now as follows:

  • Development/
    • Vagrantfile
    • trellis/
    • site1/
    • site2/

I’d recommend beginning with plain bedrock clones in the site folders to make sure you have a working setup. I’m currently running 5-6 projects like this and it’s working perfectly now.

Hope this helps!

1 Like