简体   繁体   中英

how to dump mysql db from terminal macbook

I'm a new MacBook Pro user. Because the file is so large, I need to import it from terminal.

I already know how to import and export MySQL data using terminal in Linux, but since I'm newbie in the iOS environment, I'm lost.

I think I'm missing something, maybe the path or anything, I just don't know.

I'm using XAMPP. I access my htdocs file from terminal, with this

cd /Applications/xampp/xamppfiles/htdocs/abcFolder

and then i try to import my db with this :

mysql -u root mir_existing < mirdb_21_november_2016\ \(1\).sql

Since I have no password, I remove the -p syntax.

But when I press enter to run the script, the result is command not found.

Many of you referred me to this page. How can I access the mysql command line tool when using XAMPP in OS X?

I already did it, but I don't know where to access my mysql file path to import the db. It's different.

For example. i need to run this script to import the db right?

mysql -u mysql_user -p DATABASE < backup.sql

for example, my backup.sql is on htdocs/abcFolder/backup.sql How can access it ?

Should I try this?

 mysql -u mysql_user -p DATABASE < htdocs/abcFolder/backup.sql

i already tried that thing. nothing happen. sigh.

在此处输入图片说明

How do I import my db?

If doing

which mysql

doesn't yield any results, you'll need to add the /path/to/mysql to your PATH variable and put it in your .bash_profile or .bashrc for future use so you don't have to keep adding it. After adding it to one of these files, just do

source .bash_profile

or

source .bashrc

depending on where you put it.

eg on one of my macs I use MAMP and need access to the bins it provides (mysql among them) so this is in my .bash_profile:

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM