Report this

What is the reason for this report?

Problem connect php 7.3 and MYSQL 8

Posted on January 15, 2020

Hi, I can’t connect php 7.3 with cluster database mysql 8 I did tests with previous versions of php 5.7, 7.1 and 7.2 also

User native

# user, plugin, host
'doadmin', 'mysql_native_password', '%'

PHP

<?php
ini_set('display_errors', 1);
$servername = "db-mysql-xxxxx-do-user-xxxxxx.db.ondigitalocean.com";
$username = "doadmin";
$password = "password";

echo "$username";
// Create connection
$conn = new mysqli($servername, $username, $password);

// Check connection
if ($conn->connect_error) {
    die("Connection failed: " . $conn->connect_error);
} 
echo "Connected successfully";
?>

Error

Warning: mysqli::__construct(): (HY000/2003): Can't connect to MySQL server on 'db-mysql-xxxxx-do-user-xxxxxx.db.ondigitalocean.com' (110) in /home/151548/public_html/prueba.php on line 9
Connection failed: Can't connect to MySQL server on 'db-mysql-xxxxx-do-user-xxxxxx.db.ondigitalocean.com' (110)

....

I read several DigitalOcean tutorials but none has helped me, what can I do?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.