access remote Digitaocean databases PHP - Mysql

I want to use the new DigitalOcean MySQL Managed Databases with my PHP application but I’m getting this error here:

Connect Error (2003) Can’t connect to MySQL server on ‘’ (110)

already change the database password type to: mysql_native_password

I still have the same error can someone help me connect?

I am using this code

$mysqli = new mysqli('<host>', '<user>', '<password>', '<database>');

 * This is the "official" OO way to do it,
 * BUT $connect_error was broken until PHP 5.2.9 and 5.3.0.
if ($mysqli->connect_error) {
    die('Connect Error (' . $mysqli->connect_errno . ') '
            . $mysqli->connect_error);

 * Use this instead of $connect_error if you need to ensure
 * compatibility with PHP versions prior to 5.2.9 and 5.3.0.
if (mysqli_connect_error()) {
    die('Connect Error (' . mysqli_connect_errno() . ') '
            . mysqli_connect_error());

echo 'Success... ' . $mysqli->host_info . "\n";


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

This comment has been deleted


I would recommend checking the following:

  • Make sure that you have specified the 25060 MySQL port in your connection string, it is not the default one so you need to specify it explicitly

  • Make sure that you have added your Droplet’s IP under the trusted sources for your Managed database

  • Make sure that the outgoing TCP traffic for port 25060 is allowed on your droplet

Hope that this helps! Regards, Bobby