What is the common error message when using mysql_connect in PHP?

When using mysql_connect in PHP, a common error message is "Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead." This error occurs because the mysql extension is no longer supported in newer versions of PHP. To solve this issue, you should switch to using mysqli or PDO for connecting to MySQL databases in PHP.

// Connect to MySQL using mysqli instead of mysql_connect
$servername = "localhost";
$username = "username";
$password = "password";
$dbname = "database";

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

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