1010Importing a MySQL File with Command Line

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 

Import on Local Server

mysql -u username -p db_name < ~/path/to/db/file.sql

Import with specified Server

mysql -u username -p -h hostname db_name  < ~/path/to/db/file.sql

Checking Status of MySQL Server

mysqladmin -u username -p -h hostname status
  • -p asks for the password on execution
  • Importing a ca. 300MB file takes ca. 5 seconds.
  • Make sure the DB "db_name" already exists.

Troubleshooting

I exported all the DB from one installatino as one, big localhost.sql and then tried to import it in another one. That creates the following error:

ERROR 2006 (HY000) at line 127571: MySQL server has gone away

Some DBs have been imported, but not all.

Workaround: Export/Import DBs individually.

560#import vs #include in Objective C – A quick reminder

#import is identical to #include, except that it makes sure that the same file is never included more than once. It’s therefore preferred and is used in place of #include in code examples throughout Objective-C–based documentation.

http://developer.apple.com/ mac/library/documentation/ cocoa/conceptual/ObjectiveC /Articles/ ocDefiningClasses.html