14

how to import and export mysql dump file in mac

like in windows, I use this code:

mysqldump -u root -p --databases DBname>d:\ FILENAME.sql

but it does not work in mac terminal. it produce error:

-bash: mysqldump: command not found
horcrux
  • 6,493
  • 6
  • 27
  • 40
Neeraj Sharma
  • 277
  • 1
  • 4
  • 15

2 Answers2

25

The location where mysqldump is installed need to be declared in your $PATH.

If you don't know how to edit your $PATH on macOS, you can refer to this question.

For example, if your mysqldump binary is located in /usr/local/mysql/bin, you can edit your $PATH to:

export PATH=$PATH:/usr/local/mysql/bin

With this modification, you won't have to provide the full path to the mysqldump binary every time and will be able to use your command:

$ mysqldump -u root -p --databases DBname>d:\ FILENAME.sql
Community
  • 1
  • 1
HiDeo
  • 10,128
  • 8
  • 45
  • 46
6

i forget to give path to it the query is

/usr/local/mysql/bin/mysqldump -uroot -p friendstree > friendstree.sql

it worked

Neeraj Sharma
  • 277
  • 1
  • 4
  • 15