11

I have installed Homestead with

vagrant box add laravel/homestead vagrant init vagrant up

I can login with user vagrant:vagrant, but I can't login as root!

root:root and root:vagrant is wrong password.

I have solution: there is no root password, because user "vagrant" can run sudo -s bash.

Samarkand
  • 111
  • 1
  • 1
  • 6
  • Possible duplicate of [Laravel Homestead: Nginx failing to start on Vagrant. Need root password to access Nginx logs](http://stackoverflow.com/questions/24368281/laravel-homestead-nginx-failing-to-start-on-vagrant-need-root-password-to-acce) – Hollings Apr 17 '17 at 16:31

5 Answers5

16

For me, I was able to type sudo su and then I became root.

See https://laracasts.com/discuss/channels/laravel/root-password-for-homestead-not-mysql-root-password/replies/107601 and https://stackoverflow.com/a/28097781/470749

Ryan
  • 22,332
  • 31
  • 176
  • 357
  • First link is broken: ` You have ventured into 404 space. (Page Not Found)` – Pathros Aug 15 '21 at 01:30
  • @Pathros Thanks. That's why I wrote the answer first rather than just pasting a link. But I wanted to give credit to how I learned it. – Ryan Aug 15 '21 at 14:29
7

According to the docs, the vagrant user default password is just vagrant.

This user should be setup with the insecure keypair that Vagrant uses as a default to attempt to SSH. Also, even though Vagrant uses key-based authentication by default, it is a general convention to set the password for the "vagrant" user to "vagrant". This lets people login as that user manually if they need to.

Jim
  • 310
  • 3
  • 7
1

The username and password for both databases is homestead / secret. Follow the section "Connecting to Databases" at https://laravel.com/docs/8.x/homestead#connecting-to-databases

Naveed Anwar
  • 186
  • 1
  • 8
  • This is not accurate in my experience. The output when restarting PHP states the username is vagrant, and I've tried password 'secret' and it's not accepted. Maybe this was version specific? It is true for databases, but not the service / ssh itself. – Spencer Hill Aug 20 '21 at 20:54
0

Try this password: secret

I think that password works.

0

Ive come to a solution by changing the port: DB_PORT=33060 in the .env file

DB_CONNECTION=mysql
DB_HOST=localhost
DB_PORT=33060
DB_DATABASE=homestead
DB_USERNAME=homestead
DB_PASSWORD=secret
alex
  • 1