Matt Bannert
Matt Bannert

Reputation: 28274

Add mysqldump to MAMP (MySQL /w Apache PHP on MacOS X)

I wonder how I can add mysqldump to my MAMP environment. I googled a bit and found only the community MySQL server version. But I do not want to install another MySQL – basically because I want to save my data first, before any experiment.

Upvotes: 44

Views: 34982

Answers (5)

Fredrick SujinDoss
Fredrick SujinDoss

Reputation: 11

This will helps you to resolve:

  1. In your home directory create or edit the file .bash_profile you can access your home directory by typing: cd ~/
  2. Add this to the top of the file:

    export PATH=$PATH:/Applications/MAMP/Library/bin

  3. Save the file and then restart your Terminal

  4. In your newly restarted Terminal window type: mysql –version

Upvotes: 1

Emanuil Rusev
Emanuil Rusev

Reputation: 35255

In .bash_profile, add PATH="$PATH:/Applications/MAMP/Library/bin".

If you don't have a .bash_profile, you can create one.

Upvotes: 19

Swapnil Mokashi
Swapnil Mokashi

Reputation: 37

/usr/local/mysql-5.6.20-osx10.8-x86_64/bin/mysqldump -u root -p databasename tablename > /Library/WebServer/Documents/upload/kg_exam_metadata.sql;

Upvotes: 0

Andrew Lazarus
Andrew Lazarus

Reputation: 1068

I've recently discovered that MAMP PRO hides all your mysql terminal abilities.

Using this though copies all the mamp Mysql magic over to your local bin, where you can start using all wp-cli db functions again or anything that you need with databases via terminal:

sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql; 
sudo ln -s /Applications/MAMP/Library/bin/mysqlcheck /usr/local/bin/mysqlcheck; 
sudo ln -s /Applications/MAMP/Library/bin/mysqldump /usr/local/bin/mysqldump

Upvotes: 11

Matt Bannert
Matt Bannert

Reputation: 28274

Found the solution on my own. Maybe this helps other Mac users... In fact mysqldump ships with MAMP but is located somewhere in the desert:

/Applications/MAMP/Library/bin/mysqldump

That´s why tools like MySQL workbench do not find it, neither does it work in terminal without the path. So finally just type:

/Applications/MAMP/Library/bin/mysqldump -u yourUser -p --opt yourdb > yourdump.sql

to create a dump.

Upvotes: 129

Related Questions