开发者

Mysql command for running .txt file

开发者 https://www.devze.com 2023-01-19 14:59 出处:网络
I have a .txt file in which i have created database and tables.开发者_如何学C 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

I have a .txt file in which i have created database and tables.开发者_如何学C 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?


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.


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
0

精彩评论

暂无评论...
验证码 换一张
取 消