This tutorial goes through the steps of how to import a SQL script file into a MySQL database. The computer setup I'm using for this step-by-step guide includes Windows XP Professional and MySQL 5.0, however you should also be able to use this same process for importing SQL dump files with MySQL 4.1.
1. Open the MySQL Command Line Client and type in your password, and press Enter to login. See Figure 1.
2. Change to the database you want to use for importing the .sql file data into. Do this by typing
USE your_database_name
and press Enter. See Figure 2.
For example the full line would look like: mysql> USE myTestDatabase
3. Now locate the .sql file you want to execute. For instance if the file is located in the main local C: drive directory and the .sql script file name is currentSqlTable.sql, (See Figure 3) you would type the following:
\. C:\currentSqlTable.sql
and press Enter to execute the sql script file.
For example, the full line would look like: mysql> \. C:\ currentSqlTable.sql
Note: You can use either the source or \. command to execute a SQL script file. For instance:
mysql> source file_name
mysql> \. file_name