It can sometimes be a bit nerve-racking when you want to import a SQL file into a single table of a MySQL database. There is always the unknown, getting the file right, and the fact that things can go wrong. Here’s an example of how to import data into MySQL from the command line.
First, I like to make a backup of the database.
% mysqldump databasename > databasename.backup.sql
This will create a backup that you can easily import back into MySQL if something goes wrong.
Now, get your single table SQL import file ready, and run this:
% mysql -u username -p databasename tablename < tablename.import.sql If you want to import the entire back you just created, do this: % mysql -u username -p databasename < databasename.backup.sql That's all there is to it. -Dan