tags:

views:

30

answers:

2

I have a .txt file in which i have created database and tables. I want to run it on mysql command line window. I used the command source C:\Dbbut it failed to open it. Do i need to use some other command for it?

+2  A: 

Your command has correct syntax and it should work if you really have file "c:\Db" and have permissions to read it. Maybe it's C:\Db.txt or C:\Db.sql ?

As you are using Windows, please check Folder Settings to disable hiding filename extensions for known filetypes.

Māris Kiseļovs
THANKS...IT IS WORKING
shilps
A: 

do something like this:

1.create and save your sql script file (for example c:\mywork\foo.sql)

use foo_db;

drop table if exists users;

create table users
(
user_id int unsigned not null auto_increment primary key,
username varchar(32) unique not null
)
engine=innodb;

insert into users (username) values ('f00'),('bar');

select * from users order by user_id;

2.start mysql command and login (mysql.exe located in the mysql bin folder)

3.type the following command and hit enter to run foo.sql

\. c:\mywork\foo.sql
f00