Accede a todo EDteam con un único pago¡Sube a premium!

Luigi Alonso Yovera Torres@luigialonsoyoveratorres

Me sale este error cuando trato de conectar Mysql y PHP.

ERROR SQLSTATE [[HY000]] [[2054]] The server requested authentication method unknown to the client

Esta es mi conexion y no sé el error.

<?php
    function Conecta(){
        
        try{
            $cadena = "mysql:host=localhost;dbname=machis";
            $conexion = new PDO($cadena,"root","database");
            return true;
        }
        catch(PDOException $e){
            echo "ERROR ". $e->getMessage();
        }

    }
?>

Escribe una respuesta

Pregunta a ChatEDT