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
  • 4,098
  • 11
  • 44
  • 82

1 Answers1

0

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

mysql -p -u USERNAME DATABASE < SQLFILE.sql
Samuil Banti
  • 1,735
  • 1
  • 15
  • 26
  • 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
  • what fuck is that where is full path? how is it possible if someone put the above command in cmd will work, no way it's will not work – Siraj Ali Aug 11 '22 at 13:52
  • how is it possible if someone put the above command in cmd you think it will work! no way it's will not work........... if someone new and they have no idea about complete path how they will understand your answer, if want to help some then please give him detailed answer............................................................................................................... like this macbook$ /Applications/XAMPP/xamppfiles/bin/mysql -p -u USERNAME DATABASE < SQLFILE.sql – Siraj Ali Aug 11 '22 at 14:04