1

I have some questions since I am new to the Laravel/Homestead environment.

Question 1) In the docs here, it says that the homestead box comes with MySQL out of the box. If I go to my project/config/database.php file, I can see that there are some default details already there for mysql:

'mysql' => [
            'driver'    => 'mysql',
            'host'      => env('DB_HOST', 'localhost'),
            'database'  => env('DB_DATABASE', 'forge'),
            'username'  => env('DB_USERNAME', 'forge'),
            'password'  => env('DB_PASSWORD', ''),
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
            'strict'    => false,
        ],

The thing is that whenever I SSH into my box using homestead ssh and I successfully connect to my box, I run the command mysql and it shows the following:

ERROR 1045 (28000): Access denied for user 'vagrant'@'localhost' (using password: NO)

I don't know why it is not letting me enter the mysql console. I even try mysql -u forge and it shows me the error above as well. I was wondering why am I getting this error and potentially how would I be able to fix it/successfully connect to the mysql console inside my box.

Question 2) I am really interested in installing phpMyAdmin.

I followed the following thread (I followed the second most up-voted answer, since I read somewhere that if you serve a route in laravel, like the procedure of the first answer in the thread, it is kind of temporary and you would have to do it every time you halt/up the box), but it did not work for me. My browser just tries connecting to phpmyadmin @ http://phpmyadmin.dev and it just doesn't work (the connection times out after a while). I made sure to add phpmyadmin into my hosts file:

127.0.0.1 phpmyadmin.dev

as well as in my homestead.yaml file:

sites:
     -map: phpmyadmin.dev
      to:  /home/vagrant/Code/phpmyadmin

I am sure that my box is mapping folders correctly since I have other apps that I can successfully connect to in my browser (for example test.app works perfectly)

Question 3) I was wondering if I can use a MySQL database I have installed in my local machine (not in my vagrant/homestead box). If so, what would I need to set up? I would also like to know what would be easier, working with MySQL in the box (which I think it would make more sense, since the whole point of having a vagrant/homestead box is to isolate your dev environment) or in my local machine, or it just comes up to your own choice.

Thank you for all your advice/help in advance!

Cheers!

Community
  • 1
  • 1
idelara
  • 1,786
  • 4
  • 24
  • 48
  • The default mysql username and password for a homestead instance is `homestead:secret`. You will need to supply those as params when you execute the `mysql` command via the terminal. As for phpmyadmin, I'm pretty sure homestead comes with it pre installed all you need to do is add a rule to your computers hosts file in my case I use this `192.168.10.10 phpmyadmin.app`. I have nothing in my homestead.yaml relating to phpmyadmin. – Jeemusu Jul 21 '15 at 02:52
  • The homestead/secret worked... Thanks a lot! But now how do I see which databases are present? I tried show databases and it did not work... are there even any by default? and I tried the `192.168.10.10 phpmyadmin.app` and it just shows me the contents of `test.app`. Are you sure that homestead comes with it by default? How did you install phpmyadmin? Thanks for your help! – idelara Jul 21 '15 at 03:04
  • I was not restarting my box, so when I did a `homestead destroy` & a `homestead up`, it made my `phpmyadmin.app` redirect me successfully to phpMyAdmin! Thanks a lot! – idelara Jul 21 '15 at 03:11
  • Actually, come to think of it I remember using the script (option 1) from the first answer you linked to install phpMyAdmin. Hasn't stopped working for me, and I have halted/up the several times a week. – Jeemusu Jul 21 '15 at 03:54
  • with response 2 is up and running, and it was easier for me since I dont really use bower. Thanks anyways! – idelara Jul 21 '15 at 04:24

1 Answers1

2

Question 1) Turns out I just needed to use the credentials homestead as username and secret as password. After that, I could made all the modifications to my MySQL databases.

Question 2) Using that other thread on SO, with the second most up-voted answer, I could use phpMyAdmin. I was not restarting my homestead box, therefore I could not see the changes. After a restart, everything worked flawlessly.

Question 3) I am sticking with composer migrations for this one :)

Thanks to @Jeemusu for helping me out!

Cheers!

idelara
  • 1,786
  • 4
  • 24
  • 48