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

iLuca's avatar
Level 1

Heroku, I have exported my database on the heroku db (postgre), however i can't seem to login with the admin login credentials (Laravel 9).

As the title states, I have basically deployed my Laravel app on Heroku, however I can't seem to login with the accounts I have created in local . In local I did create a couple of accounts as well as an admin account with a seed. I have exported all the migrations on Heroku and everything worked fine. Somehow, I can't seem to use that admin account :/

0 likes
29 replies
Sinnbeck's avatar

Ok so you exported the database from local to an sql file and imported it on heroku ?

iLuca's avatar
Level 1

@Sinnbeck not really, I have first added the postgre database on my heroku app, then through the heroku bash (heroku run bash) I have simply did php artisan migrate

Sinnbeck's avatar

@iLuca Ah. But that just creates the tables. It does not add any data. How did you create the users locally ? With a seeder or via the browser?

iLuca's avatar
Level 1

@Sinnbeck the Admin with a seeder, the 2 others simply through the website in localhost (also for testing the login/register functionality)

Sinnbeck's avatar

@iLuca Also on heroku ? Can you somehow see the contents of the database on heroku? If not try php artisan tinker and the User::first();

iLuca's avatar
Level 1

@Sinnbeck Not on heroku only in local I have run the seed. I try to look for the content of the db on heroku, however I wasn't able to find it. Should I try the PHP artisan thinker and the User::first() on Heroku?

Sinnbeck's avatar

@iLuca Running it locally does nothing for heroku. They are different systems, and the data in the database isnt transfered when deploying. So run the command on heroku

iLuca's avatar
Level 1

@Sinnbeck Yeah basically what I have done is heroku run bash: enter in the heroku bash and then performed the php artisan thinker and the User::first() Not quite sure what you mean by admin user?

iLuca's avatar
Level 1

@sinnbeck I was thinking should I perhaps do a dump of the db (btw I am using mysql and mysql workbench in local) and then apply it to heroku, for indeed filling it up?

Sinnbeck's avatar

@iLuca You where the one saying admin?

admin login credentials

Ok. Maybe try changing the password of the user

User::first()->update(['password' => Hash::make('newpassword')]);
iLuca's avatar
Level 1

@Sinnbeck But why would I need to do that? The database is indeed attached and the structure seems to be present, what is missing is indeed the content. And what does this User::first() do? I am just a bit afraid to mess things up...

Sinnbeck's avatar

@iLuca I have no idea why you would need to do that. It should just work, but as it does not, you need to try and fix it. I cannot really do much except help.

You can target the user if you want. User 1 is the one from the screenshot

User::find(1)->update(['password' => Hash::make('newpassword')]);
iLuca's avatar
Level 1

@Sinnbeck I was thinking that maybe a simple dump would have helped stackoverflow.com/questions/46191129/how-to-export-demo-dump-or-demo-sql-file-to-heroku-database

iLuca's avatar
Level 1

@Sinnbeck Yes, like perform a dump of the db and import it on heroku, however I thought that by simply adding the migrations on heroku the content of the db would have included too.

iLuca's avatar
Level 1

@Sinnbeck From what I could understand so far, if I want to add the admin account to the database I would need to do so with PHP tinker or directly via the table on heroku (however I cannot visualize any data on heroku itself). How would I be able to do that with tinker then?

martinbean's avatar

@iluca It sounds like you really need to do some tutorials on how Laravel works, let alone an opinionated PaaS like Heroku.

Heroku isn’t your every day web host. It strongly enforces best practices in structuring and decoupling web apps.

You’re not going to be able to run seeds because Heroku runs composer install --no-dev when deploying, so the class maps for dev dependencies (like your factory and seed classes) are going to be built. You need to create the user in the Heroku database; not your local database.

iLuca's avatar
Level 1

@martinbean How can I then create my main admin user (which is mainly what I need ) on the heroku database?

martinbean's avatar

@iLuca By connecting to your database and creating the row, or inserting it via a Tinker session.

iLuca's avatar
Level 1

@martinbean I am sorry since I am a bit of a noob when it comes to heroku or laravel, do you mind showing me in details how to do that?

iLuca's avatar
Level 1

@martinbean In addition, I don't know if perhaps there is a guide somehow online, so far I haven't found it. It really seems that on heroku (using postgre heroku btw) I cannot visualize the database with its content

martinbean's avatar
Level 80

@iLuca You can. You just need to connect to it using a GUI tool like TablePlus. I work with Heroku daily.

iLuca's avatar
Level 1

@martinbean Thank you very much, I managed to fix my issue! Much appreciated!

1 like

Please or to participate in this conversation.