3

I want to import the large database using command prompt in MAC. I have seen similar question answered.(Youtube Link: https://www.youtube.com/watch?v=9clyBrkclQ8 )

From the MySQL console:

mysql> use DATABASE_NAME;
mysql> source path/to/file.sql;

But recently I have started using MAC; I have looked around for the solution to do the same in MAC but did not find anything. Has anyone tried to do this on MAC? Thanks for the help.

Community
  • 1
  • 1
Hitesh
  • 3,882
  • 10
  • 40
  • 81

1 Answers1

1

If you execute the following command in the terminal it should do the job.

mysql -p -u USERNAME DATABASE < SQLFILE.sql
Samuil Banti
  • 1,527
  • 12
  • 23
  • When I use this command I get the following output: mysql Ver 15.1 Distrib 10.1.16-MariaDB, for Win32 (AMD64) Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others. Usage: mysql [OPTIONS] [database] Default options are read from the following files in the given order: C:\Windows\my.ini C:\Windows\my.cnf C:\my.ini C:\my.cnf C:\xampp\mysql\my.ini C: \xampp\mysql\my.cnf C:\xampp\mysql\bin\my.ini C:\xampp\mysql\bin\my.cnf The following groups are read: mysql client client-server client-mariadb The following options may be given as the first argument: – James Jan 18 '17 at 15:01
  • It looks like you are using windows terminal. You may try this: `cmd.exe /c "mysql -u USERNAME -p DATABASE < SQLFILE.sql"` and don't forget to set the complete path to the file. – Samuil Banti Jan 18 '17 at 16:17