Hi! You need to:
- Install Mysql 8 in your droplet (to connect with managed database)
- Create (or change an existent) an user with auth plugin
To create a new user:
First, you need to connect Mysql using a compatible client (in my case, TablePlus) with Digital Ocean default user (doadmin), and them, run the command bellow:
CREATE USER 'your_new_user'@'host' IDENTIFIED WITH mysql_native_password BY 'password';
If you have created an user in DO interface, you can do this:
ALTER USER your_user IDENTIFIED WITH mysql_native_password BY 'your_password';
Finally, make GRANT ALL for your database:
GRANT ALL PRIVILEGES ON your_database.* TO 'your_user'@'host'
Still in the TablePlus, you can import your tables from old database to new one.
In PHP connection:
First, you have to download ca-certificate.crt to php file folder. After do this, run the code bellow:
$con = mysqli_init();
$con->ssl_set(NULL, NULL, "ca-certificate.crt", NULL, NULL);
$con->real_connect('host', 'your_user', 'your_password', 'your_database', 25060);
And done! That’s all!
Note: PHP does not support auth plugin
caching_sha2_password yet (default in Mysql 8). In future, maybe, but not yet. Sorry for my English! ;)