0

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.

enter image description here

How do I import my db?

Community
  • 1
  • 1
gutasaputra
  • 169
  • 1
  • 3
  • 19
  • 4
    Possible duplicate of [How can I access the mysql command line tool when using XAMPP in OS X?](http://stackoverflow.com/questions/3354046/how-can-i-access-the-mysql-command-line-tool-when-using-xampp-in-os-x) – aynber Nov 22 '16 at 18:06
  • see: http://stackoverflow.com/questions/22391778/mysql-command-line-bash-command-not-found possibly the export path solution will solve your problem – Duane Lortie Nov 22 '16 at 18:08
  • Try **find / -name mysql 2>/dev/null** to find the path where you installed mysql. then you can put the path before your cmd like **/PATH.../mysql -u root mir_existing < mirdb_21_november_2016\ \(1\).sql** – Bernd Buffen Nov 22 '16 at 18:08
  • Possible duplicate of [Outlook does not recognize one or more names](http://stackoverflow.com/questions/24638124/outlook-does-not-recognize-one-or-more-names) – Cody G Nov 22 '16 at 18:20

1 Answers1

0

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.

e.g. 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"