Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

famintech's avatar

php artisan migrate access denied

Hi,

As the title says, I got this output when running php artisan migrate

PS C:\laragon\www\einvoice> php artisan migrate

Illuminate\Database\QueryException SQLSTATE[HY000] [1045] Access denied for user 'einvoice'@'14.192.212.132' (using password: YES) (Connection: mysql, SQL: SQLSTATE[HY000] [1045] Access denied for user 'einvoice'@'14.192.212.132' (using password: YES) (Connection: mysql, SQL: select table_name as name, (data_length + index_length) as size, table_comment as comment, engine as engine, table_collation as collation from information_schema.tables where table_schema = 'einvoice' and table_type in ('BASE TABLE', 'SYSTEM VERSIONED') order by table_name)

at vendor\laravel\framework\src\Illuminate\Database\Connection.php:829 825▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 826▕ ); 827▕ } 828▕ ➜ 829▕ throw new QueryException( 830▕ $this->getName(), $query, $this->prepareBindings($bindings), $e 831▕ ); 832▕ } 833▕ }

1 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65 PDOException::("SQLSTATE[HY000] [1045] Access denied for user 'einvoice'@'14.192.212.132' (using password: YES)")

2 vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:65 PDO::__construct("mysql:host=mysql.db.famin.cloud;port=3306;dbname=einvoice", "einvoice", "password", [])

All credentials in env are correct, I can connect perfectly fine using mysql directly.

PS C:\laragon\www\einvoice> mysql -h mysql.db.famin.cloud -u einvoice -p --ssl-mode=REQUIRED Enter password: ******** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 118 Server version: 8.0.39-0ubuntu0.22.04.1 (Ubuntu)

Copyright (c) 2000, 2024, Oracle and/or its affiliates.

Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql>

I guess the problem is with laravel.

0 likes
3 replies
Tray2's avatar

No, the problem is that you have the wrong credentials in your .env file. I guess you copy pasted them from somewhere, I suggest typing them manually, since it's very likely you get some invisible character when you copy paste in windows, if you copy from anything other than a text document.

Snapey's avatar

in your .env make sure the password is between quotes incase it contains # which will be treated as a comment and ignore the rest of the password.

1 like

Please or to participate in this conversation.