Thankyou
Thankyou

Reputation: 159

Laravel Homestead- How to migrate an app into the same folder and connect the MySQL database?

I was able to do install Homestead and to create a new app within the virtual machine.

However, I do have apps that I created outside the virtual machine and I would like to connect my database now. It is editable under localhost/phpmyadmin, it is my mysql standard installation in port 3306.

I have the folder that I have from the Internet and the first app that I specified is called Laravel, how do I do that?

If I just copy it in the same directory, I get:

php artisan serve
PHP Fatal error:  Class 'Barryvdh\Debugbar\ServiceProvider' not found in /home/vagrant/Code/foobooks/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 157
PHP Stack trace:
PHP   1. {main}() /home/vagrant/Code/foobooks/artisan:0
PHP   2. require_once() /home/vagrant/Code/foobooks/artisan:30
PHP   3. require() /home/vagrant/Code/foobooks/bootstrap/start.php:68
PHP   4. Illuminate\Foundation\ProviderRepository->load() /home/vagrant/Code/foobooks/vendor/laravel/framework/src/Illuminate/Foundation/start.php:210
PHP   5. Illuminate\Foundation\ProviderRepository->compileManifest() /home/vagrant/Code/foobooks/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:57
PHP   6. Illuminate\Foundation\ProviderRepository->createProvider() /home/vagrant/Code/foobooks/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php:121
{"error":{"type":"Symfony\\Component\\Debug\\Exception\\FatalErrorException","message":"Class 'Barryvdh\\Debugbar\\ServiceProvider' not found","file":"\/home\/vagrant\/Code\/foobooks\/vendor\/laravel\/framework\/src\/Illuminate\/Foundation\/ProviderRepository.php","line":157}}vagrant@homestead:~/Code/foobooks$ 
vagrant@homestead:~/Code/foobooks$ cd laravel
-bash: cd: laravel: No such file or directory

Upvotes: 1

Views: 948

Answers (1)

Pᴇʜ
Pᴇʜ

Reputation: 57743

Move your database from your host machine into homestead:

  • Install laravel homestead
  • Copy your app into your shared folder (I guess you did that so far)
  • backup your database from your host machine
  • Migrate your database in homestead with artisan migrate if you want a clean and empty database structure.
  • OR: Rebuild it from your backup. Make sure the database user/password specified in your laravel config exists in homestead and has write access to your rebuild database.

Your homestead database is still accessible from your host machine at 127.0.0.1 and port 33060 (http://laravel.com/docs/4.2/homestead#daily-usage)

Here is a nice tutorial for homestead 2.0 in case you have problems to setup: https://laracasts.com/lessons/say-hello-to-laravel-homestead-two

Upvotes: 2

Related Questions