XAMPP for MAC: Importing large SQL in Terminal

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

XAMPP for MAC: Importing large SQL in Terminal

Postby gebe » 07. September 2011 04:15

Hi,

Firstly: I am quite a newbie: done some minor things with both MySQL and Terminal, but not not in combination (so far, I did everything with PHPMyAdmin).
I hope that I am not asking a stupid question, but I am stuck for hours and making no progress...

The Problem: I need to import a really large SQL file into MySQL. PHPMyAdmin fails on that size (it says 128 MB is the maximum, I am well above that). So I tried Terminal.

Several sources recommend to import an SQL file in Terminal:

mysql -u username -p databasename < dump.sql.

However, this is not working for me, Terminal says there is no command mysql:

192-168-1-6:bin username$ ls ls mysql*
mysql mysql_setpermission mysqld_multi
mysql.server mysql_tzinfo_to_sql mysqld_safe
mysql_client_test mysql_upgrade mysqldump
mysql_config mysql_waitpid mysqldumpslow
mysql_convert_table_format mysql_zap mysqlhotcopy
mysql_find_rows mysqlaccess mysqlimport
mysql_fix_extensions mysqladmin mysqlshow
mysql_fix_privilege_tables mysqlbinlog mysqlslap
mysql_install_db mysqlbug mysqltest
mysql_secure_installation mysqlcheck
192-168-1-6:bin username$ mysql
-bash: mysql: command not found

The command is executed in /Applications/XAMPP/xamppfiles/bin/, where mysql is located according to the manual, Spotlight, and the "ls" command. I tried both, MySQL server running and MySQL server stopped (per XAMPP UI).

What am I doing wrong? How can I get my SQL file imported? I do not necessarily need to do it with Terminal, but I am just wondering why I can execute the command...

Thank you very much for any advice!

Gebe
gebe
 
Posts: 2
Joined: 07. September 2011 03:50

Re: XAMPP for MAC: Importing large SQL in Terminal

Postby Nobbie » 08. September 2011 01:51

gebe wrote:Several sources recommend to import an SQL file in Terminal:

mysql -u username -p databasename < dump.sql


Enter

Code: Select all
./mysql -u username -p databasename < dump.sql


instead (execute in /Applications/XAMPP/xamppfiles/bin/ as previously).

Or (execute where ever you want):

Code: Select all
/Applications/XAMPP/xamppfiles/bin/mysql -u username -p databasename < dump.sql


Probably you have to replace dump.sql by the full pathname as well.
Nobbie
 
Posts: 7018
Joined: 09. March 2008 13:04

Re: XAMPP for MAC: Importing large SQL in Terminal

Postby gebe » 13. September 2011 09:37

Ah, thank you very much: The "./" did the job :)
gebe
 
Posts: 2
Joined: 07. September 2011 03:50


Return to XAMPP for Mac OS X

Who is online

Users browsing this forum: No registered users and 3 guests