2

tengo un problema al ejecutar el comando php artisan migrate en la terminal de laravel, Si al .env le agrego contraseña me sale el siguiente error en la terminal:

 Illuminate\Database\QueryException  : SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file (SQL: select * from information_schema.tables where table_schema = fechas and table_name = migrations and table_type = 'BASE TABLE')

  at C:\laragon\www\FechasVencimiento\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673|

  Exception trace:

  1   PDOException::("SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please use an administration tool to reset your password with the command SET PASSWORD = PASSWORD('your_existing_password'). This will store a new, and more secure, hash value in mysql.user. If this user is used in other scripts executed by PHP 5.2 or earlier you might need to remove the old-passwords flag from your my.cnf file")
      C:\laragon\www\FechasVencimiento\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=fechas", "root", "12345", [])
      C:\laragon\www\FechasVencimiento\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

  Please use the argument -v to see more details.

Pero si le quito la contraseña, sale este error:

  Illuminate\Database\QueryException  : SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO) (SQL: select * from information_schema.tables where table_schema = fechas and table_name = migrations and table_type = 'BASE TABLE')

  at C:\laragon\www\FechasVencimiento\vendor\laravel\framework\src\Illuminate\Database\Connection.php:669
    665|         // If an exception occurs when attempting to run a query, we'll format the error
    666|         // message to include the bindings with SQL, which will make this exception a
    667|         // lot more helpful to the developer instead of just the database's errors.
    668|         catch (Exception $e) {
  > 669|             throw new QueryException(
    670|                 $query, $this->prepareBindings($bindings), $e
    671|             );
    672|         }
    673|

  Exception trace:

  1   PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: NO)")
      C:\laragon\www\FechasVencimiento\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=fechas", "root", "", [])
      C:\laragon\www\FechasVencimiento\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:70

  Please use the argument -v to see more details.

He buscado bastante acerca del error pero no me funcionan ninguna de las soluciones que dan y no se a que se deba el error, de verdad espero que me puedan ayudar ya que no puedo avanzar en mi proyecto sin antes migrar las tablas, muchas gracias.

3
  • 1
  • Bro pudiste corregir este error, igualmente ya modifique el .env y nada
    – roger
    el 15 abr. 2020 a las 0:21
  • No puedes migrar porque tu aplicación no puede conectarse a la BD, esto suele ser por errores de las credenciales o host mal configurado, en tu caso una version de mysql muy antigua: SQLSTATE[HY000] [2000] mysqlnd cannot connect to MySQL 4.1+ using the old insecure authentication. Please ... debería resolverse instalando 5.6 en adelande o mariadb
    – Orici
    el 8 jul. 2023 a las 16:17

1 respuesta 1

0

Cambia "host" en el archivo /app/config/database.php y en el archivo .env cambia ”localhost" a ”127.0.0.1”. Eso debería resolver tu problema

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.