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?
 
saifulbahriConnect With a Mentor Commented:
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
 
UmeshMySQL Principle 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
 
UmeshConnect With a Mentor MySQL Principle 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
Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

 
UmeshMySQL Principle 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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.