mysql import sql file several forms

 

1. There is no landing mysql mysql when poured in the form of data files

   added to these statements students.sql file

    create table t_student(
     id int primary key auto_increment,
     name varchar(20) not null comment '姓名'
    )Engine=InnoDB default charset utf8;


    insert into t_student values(null,'tom');
    insert into t_student values(null,'jerry');
    insert into t_student values(null,'hank');
    insert into t_student values(null,'xiaoming');

 

 

Excuting an order:
  

MySQL - -uroot - the p- </ the WWW / Example / students.sql the Test # the Test is the name of the database

 

2. After landing mysql, you can use the source command

use test;
source </www/example/students.sql test

 

Import data load data 3


New File t_student.sql, file content:
null: Tomcat
null: Liming

Log in mysql execute the following statement

load data local infile "D:/data.sql" into table test.t_student fields terminated by ":" lines terminated by "\n"

Where the local mean to upload local files to the server and load.

 

4. import data using the command mysqlimport

mysqlimport -h 192.168.114.129 -u root -p --fields-terminated=":" --local test D:/t_student.sql

 

Guess you like

Origin www.cnblogs.com/haloujava/p/11131708.html