How to load a table in to the database.

Posted on 2008-11-05
Last Modified: 2012-06-27
Dear Experts,
I have created simple_table.sql in text pad and store it in C:\wamp\bin\mysql\mysql5.0.51b\data\project\simple_table.sql .. But when I try to run it through "source \project\simple_table.sql" it does not want to load it...
Can you tell me how to load this file, please?
create table simple_table (

last_name varchar(30),

postcode char(8)


Open in new window

Question by:Cihla

    Accepted Solution

    Do you use the mysql command line client? If so i suggest you go into directory C:\wamp\bin\mysql\mysql5.0.51b\data\project\ and then start the mysql client.

     cd C:\wamp\bin\mysql\mysql5.0.51b\data\project
     mysql -h xxx -u xxx -p
     mysql > use database
     mysql > \. simple_table.sql
    LVL 26

    Expert Comment

    what is the error you are getting???/

    I just tried it and its working for me..
    E:\MySQLMaster\bin>mysql -u root -p
    Enter password: ***
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 12
    Type 'help;' or '\h' for help. Type '\c' to clear the buffer.
    mysql> use test;
    Database changed
    mysql> source e:/test.sql
    Query OK, 0 rows affected (0.02 sec)
    mysql> desc simple_table;
    | Field     | Type        | Null | Key | Default | Extra |
    | last_name | varchar(30) | YES  |     | NULL    |       |
    | postcode  | char(8)     | YES  |     | NULL    |       |
    2 rows in set (0.00 sec)

    Open in new window

    LVL 26

    Assisted Solution

    >>source \project\simple_table.sql

    You should pass complete path to source file...

    mysql>source C:\wamp\bin\mysql\mysql5.0.51b\data\project\simple_table.sql;

    Also you can do this... from command line.. CD to mysql/bin

    mysql -uusername -ppassword DBNAME < C:\wamp\bin\mysql\mysql5.0.51b\data\project\simple_table.sql
    LVL 26

    Expert Comment

    Did you try?

    Author Closing Comment

    Hi, sorry for taking a time to reply but was quite busy..

    Author Comment

    I just forgot to to "use database" and then use the "source".

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Introduction In this article, I will by showing a nice little trick for MySQL similar to that of my previous EE Article for SQLite (, A SQLite Tidbit: Quick Numbers Table Generation (…
    Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL ( several years ago, it seemed like now was a good time to updat…
    Migrating to Microsoft Office 365 is becoming increasingly popular for organizations both large and small. If you have made the leap to Microsoft’s cloud platform, you know that you will need to create a corporate email signature for your Office 365…
    Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

    779 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    15 Experts available now in Live!

    Get 1:1 Help Now