tenancy / multi-tenant

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
https://tenancy.dev
MIT License
2.56k stars 394 forks source link

Add support for MySQL authentication plugins configuration #881

Open geodro opened 4 years ago

geodro commented 4 years ago

Description of your feature

If we use managed databases from DigitalOcean, they support only caching_sha2_password as auth plugin for mysql. We should add in config the option of what auth plugin tenancy should use.


Proposed behavior

Hyn\Tenancy\Generators\Webserver\Database\Drivers\MariaDB:42

return $connection->statement("CREATE USER IF NOT EXISTS {$config['username']}@'{$config['host']}' IDENTIFIED WITH {$config['auth_method']} BY {$config['password']}'");

where auth_method should be mysql_native_password or caching_sha2_password

Current behavior

Hyn\Tenancy\Generators\Webserver\Database\Drivers\MariaDB:42

return $connection->statement("CREATE USER IF NOT EXISTS {$config['username']}@'{$config['host']}' IDENTIFIED BY '{$config['password']}'");

Information

Plytas commented 4 years ago

If you could, please create a Pull Request with some tests so we're sure nothing breaks.