1010Importing MySQL dump file into Database

Working with XAMPP and and phpMyAdmin makes dealing with databases more visual, but importing large db dumb files can fail/take a long time.

Importing from the command line is faster and more stable.

Use the XAMPP mysql, if there is not a global mysql

cd /Applications/XAMPP/xamppfiles/bin 


./mysql -u root -p db_name < ~/path/to/db/file.sql
  • Importing a ca. 300MB file takes ca. 5 seconds.
  • Make sure the DB "db_name" already exists.

980Dumping all Databases with mysqldump

IMPORTANT: No space between -p and 'password'

mysqldump -u'username' -p'password' --all-databases > /path/all.sql

Date in file name:

mysqldump -u'username' -p'password' --all-databases > 
/path/all_`date +\%Y\%m\%d_\%H\%M\%s`.sql