How to load a table in to the database.

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

CihlaAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

saifulbahriCommented:
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
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
UmeshSenior Principal Technical Support EngineerCommented:
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)
 
mysql>

Open in new window

0
UmeshSenior Principal Technical Support EngineerCommented:
>>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
0
The Five Tenets of the Most Secure Backup

Data loss can hit a business in any number of ways. In reality, companies should expect to lose data at some point. The challenge is having a plan to recover from such an event.

UmeshSenior Principal Technical Support EngineerCommented:
Did you try?
0
CihlaAuthor Commented:
Hi, sorry for taking a time to reply but was quite busy..
0
CihlaAuthor Commented:
I just forgot to to "use database" and then use the "source".
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
MySQL Server

From novice to tech pro — start learning today.