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

marianogomez's avatar

Problem with `artisan migrate` on dreamhost

Hi guys, i'm having a problem trying to execute for the first time the php artisan migrate on my dreamhost shared server. I have everything set up (git, composer, artisan) on my server, via SSH. I've created a DB with this information on the dreamhost panel (not the actual data, of course, but similar):

- Hostname for the MySQL DB: 
 db.some_hostname.com

- Databases on this server
some_hostname_database

- Database user
db_user

And, in my server's .env file, i have this:

DB_CONNECTION=mysql
DB_HOST=db.some_hostname.com
DB_PORT=3306
DB_DATABASE=some_hostname_database
DB_USERNAME=db_user
DB_PASSWORD=somepassword

I even access the DB with 3rd party software via SSH tunneling

But when i run php artisan migrate, i get this error:

SQLSTATE[HY000] [1045] Access denied for user 'db_user'@'baron-zemo.dreamhost.com' (using password: YES) (Connection: mysql, SQL: select * from information_schema.tables where table_schema = some_hostname_database and table_name = migrations and table_type = 'BASE TABLE')

What is killing me, is why it is using @'baron-zemo.dreamhost.com', if i specified another hostname both on the dreamhost server, as well as in the .env file. Any thoughts? Thanks in advanced

0 likes
7 replies
Pippo's avatar

@marianogomez check if you have multiple definitions of DB_HOST in your .env, then go to database.php and check the default connection (default => key) and also if you have hardcoded something in your connection. Remove any "DATABASE_URL" definition in the .env and verify that the connection does not have a default or hardcoded value.

marianogomez's avatar

well i think it was related to mistakes on my side, probably i was using characters that was generating problems, i've changed the password and is working ok. Thanks to you all!

Pippo's avatar

@marianogomez in .env you can enclose the password in quotes if it contains special characters

2 likes
csautot's avatar

@Pippo Thank you! I am new to Laravel. Finding this answer helped me get my DB connection working.

1 like

Please or to participate in this conversation.