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

JaredKC's avatar

Unable to connect to DB from Laravel app or Sequel Pro

I have gone through the setup process for Laravel Valet following the docs. Everything works as expected until I try to connect an app to MySQL. After hours of trying I have been unable to connect to MySQL from a Laravel app or Sequel Pro. I can however connect from the command line with I have done to create the database.

mysql> SHOW DATABASES;
+--------------------+
| Database           |
+--------------------+
| app                |
| clivecms           |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
6 rows in set (0.00 sec)

Using Homebrew I have confirmed all requirements are up to date and services are running.

$ brew services list
Name    Status  User Plist
dnsmasq started root /Library/LaunchDaemons/homebrew.mxcl.dnsmasq.plist
mysql   started jkc  /Users/jkc/Library/LaunchAgents/homebrew.mxcl.mysql.plist
nginx   started root /Library/LaunchDaemons/homebrew.mxcl.nginx.plist
php     started root /Library/LaunchDaemons/homebrew.mxcl.php.plist

After updating the .env file I run php artisan migrate and get the following error.

 Illuminate\Database\QueryException  : SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client (SQL: select * from information_schema.tables where table_schema = app and table_name = migrations)

  at /Users/jkc/Sites/app/vendor/laravel/framework/src/Illuminate/Database/Connection.php:664
    660|         // If an exception occurs when attempting to run a query, we'll format the error
    661|         // message to include the bindings with SQL, which will make this exception a
    662|         // lot more helpful to the developer instead of just the database's errors.
    663|         catch (Exception $e) {
  > 664|             throw new QueryException(
    665|                 $query, $this->prepareBindings($bindings), $e
    666|             );
    667|         }
    668| 

  Exception trace:

  1   PDOException::("PDO::__construct(): The server requested authentication method unknown to the client [caching_sha2_password]")
      /Users/jkc/Sites/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

  2   PDO::__construct("mysql:host=127.0.0.1;port=3306;dbname=app", "root", "", [])
      /Users/jkc/Sites/app/vendor/laravel/framework/src/Illuminate/Database/Connectors/Connector.php:68

When I try and connect through Sequel Pro I get this error.

Unable to connect to host 127.0.0.1, or the request timed out.

Be sure that the address is correct and that you have the necessary privileges, or try increasing the connection timeout (currently 10 seconds).

MySQL said: Authentication plugin 'caching_sha2_password' cannot be loaded: dlopen(/usr/local/lib/plugin/caching_sha2_password.so, 2): image not found

Any help in resolving this issue would be greatly appreciated.

0 likes
5 replies
Strigo's avatar

i have the same problem... cant figure it out

jlrdw's avatar

You don't have two instances of mySQL by chance and accidentally trying to connect to the wrong one?

JaredKC's avatar

I believe multiple MySQL instances may have been the problem. Things were working fine for months and this problem arrised suddenly. I finally got everything working when i completley removed Valet and went with the Docker solution.

ejdelmonico's avatar

@JaredKC There are known issues with having Docker running in the background and trying to use Valet. If you make sure Docker instances are halted before running Valet...and vice versa...you can use either one.

Please or to participate in this conversation.