Certainly! The error message:
Access denied for user 'forge'@'localhost'
suggests that MySQL is seeing the connection as coming from "localhost" and rejecting the credentials. Here are some things to check and try:
1. Double-Check SSH Tunnel
Make sure your SSH tunnel is running and active. You should keep the terminal with this command open:
ssh -L 3307:127.0.0.1:3306 [email protected]
If you accidentally closed the tunnel or it disconnected, your app would attempt to connect to your local (non-Forge) MySQL server, which may not have a user forge.
2. MySQL User Host Setting
MySQL user permissions are host-based. If your MySQL user on the server is only allowed to connect from certain hosts, you may see this error. Check your MySQL users on the Forge server by running:
SELECT user, host FROM mysql.user WHERE user = 'forge';
You should see a row like:
forge | localhost
or
forge | %
If the Forge user is only permitted for localhost, that's correct for SSH tunnel usage. But if not, you may need to adjust user privileges.
3. .env and Config Cache
Make sure your .env is up to date, and clear Laravel's config cache just in case:
php artisan config:clear
Ensure the .env points to:
DB_HOST=127.0.0.1
DB_PORT=3307
DB_DATABASE=my_db
DB_USERNAME=forge
DB_PASSWORD=my_password
4. Test Using Command Line
From your local machine, while the tunnel is active, try:
mysql -h 127.0.0.1 -P 3307 -u forge -p
If you get the same error, the problem isn't Laravel—it's the tunnel or MySQL credentials.
5. MySQL Password
Double-check that the password for the forge user hasn't recently been changed on the live server.
6. Another Forge Site is Working
Since you mention another Forge site is working, perhaps that database has different user settings, or you may be tunneling to a different server or port without realizing.
Summary Checklist
- Is the SSH tunnel up and stable?
- Are your Laravel
.envvalues correct? - Does the MySQL
forgeuser have privileges forlocalhost? - Can you connect via the CLI with the same credentials?
- Has the password for the
forgeuser changed?
If everything seems correct but it still fails, try restarting the tunnel and double-checking the server IP and port.
Let me know if you find anything unusual in these steps!