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?
-
Can you post a few lines of the text file so we can see what sort of file it is?Mark Byers– Mark Byers2010-10-10 07:00:07 +00:00Commented Oct 10, 2010 at 7:00
Add a comment
|
2 Answers
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