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
Tuesday, April 15, 2008
Subscribe to:
Post Comments (Atom)
8 comments:
Thank you so much! I tried 5 tutorials but only this works! Thanks again!!!
great. thank you from the bottom of my heart. I checked so many sites for this simple explanation and this is really simple explained and it FINALY worked.
Thanks again
top! agree to the above, gah really need to brush up on some sql usage.
thank you
Very concise and simple. Thank you! My heart filled with happiness to see over half a million records integrated in less than 5 mins.
I cant see any of the pictures.
Wow, thanks a lot. Finally something worked.
Really. I tried several things they suggested in other sites.
Thanks a lot again.
many many thanks :)
Post a Comment