4

In window cmd ,I usually do like this and it is working

C:\Users\davi> mysql -u root -p mydb < D:/xampp/mysql/bin/db.sql

I am new in vagrant , this is what I do in vagrant ssh

[vagrant@localhost bs]$ mysql -u root -p mydb < D:/xampp/mysql/bin/db.sql

But I got this error

-bash: D:/xampp/mysql/bin/db.sql: ??????????????????????

Is there anyway to import correctly ?

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
Jack jdeoel
  • 4,554
  • 5
  • 26
  • 52
  • Probably path is wrong. In Vargant files have different location. Read about `mount` etc.. https://www.vagrantup.com/docs/synced-folders/ – bato3 Jun 21 '17 at 10:28

2 Answers2

18

You do not have D:/xampp/mysql/bin/db.sql from your vagrant VM

  1. Place the file db.sql in the same folder where you have the Vagrantfile

  2. vagrant ssh as you normally do to get into the VM

  3. run the following command to import the db

    $ mysql -u root -p mydb < /vagrant/db.sql
    

The /vagrant folder is a default shared folder in the VM.

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139
0

Copy DB.sql under your project folder in Windows

In Vagrant after mysqling into database, you can access your source /var/www/PROJECTNAME/DB.sql

Smit Patadiya
  • 1,488
  • 1
  • 9
  • 6