What could be causing the "Connection to localhost:62541 refused" error in PhpStorm Database Navigator when trying to synchronize?

The "Connection to localhost:62541 refused" error in PhpStorm Database Navigator could be caused by a firewall blocking the connection or incorrect database settings. To solve this issue, make sure the database server is running and accessible, check the firewall settings to allow connections on port 62541, and verify the database credentials are correct.

// Example PHP code snippet to connect to a MySQL database using PDO
$host = 'localhost';
$port = '62541';
$dbname = 'database_name';
$username = 'username';
$password = 'password';

try {
    $conn = new PDO("mysql:host=$host;port=$port;dbname=$dbname", $username, $password);
    $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
    echo "Connected successfully";
} catch (PDOException $e) {
    echo "Connection failed: " . $e->getMessage();
}