0

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?

1
  • Can you post a few lines of the text file so we can see what sort of file it is? Commented Oct 10, 2010 at 7:00

2 Answers 2

2

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.

Sign up to request clarification or add additional context in comments.

Comments

0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.